3

How do I stop this exception from being printed in the log file catalina.out? It takes up a lot of room in the log file.

2018-10-12 02:25:20.394 ERROR 20077 --- [nio-8080-exec-7] o.s.boot.web.support.ErrorPageFilter     : Forwarding to error page from request [/home] due to exception [The request was rejected because the URL contained a potentially malicious String ";"]

org.springframework.security.web.firewall.RequestRejectedException: The request was rejected because the URL contained a potentially malicious String ";"
    at org.springframework.security.web.firewall.StrictHttpFirewall.rejectedBlacklistedUrls(StrictHttpFirewall.java:265) ~[spring-security-web-4.2.6.RELEASE.jar:4.2.6.RELEASE]
    at org.springframework.security.web.firewall.StrictHttpFirewall.getFirewalledRequest(StrictHttpFirewall.java:245) ~[spring-security-web-4.2.6.RELEASE.jar:4.2.6.RELEASE]
+50 more lines

I don't mind the single line ERROR but I'd rather not see the stack trace while scrolling through the log.

They are caused by testing requests like

172.31.43.154 - - [12/Oct/2018:07:52:42 +0000] "POST /dologin HTTP/1.1" 302 0 "-" "python-requests/2.18.4" "99.99.99.99"
172.31.43.154 - - [12/Oct/2018:07:52:42 +0000] "GET /home;jsessionid=4B9B7C8FFC2EA0B7A8E0C2E20E0B4D79 HTTP/1.1" 200 27 "-" "python-requests/2.18.4" "99.99.99.99"

I don't know if the tester is manually adding the cookie to the URL or being redirected to that path. It works in the browser and I already have

server.session.tracking-modes=cookie
Chloe
  • 25,162
  • 40
  • 190
  • 357
  • https://stackoverflow.com/a/48636757/1851286 This solution works for "The request was rejected because the URL contained a potentially malicious String ";"" – Oleksii Kyslytsyn Nov 03 '18 at 09:51
  • 1
    That's to turn off the firewall security. I want to turn off the logging of the error, or minimize the logging from a stack trace to a single line. – Chloe Nov 06 '18 at 02:24
  • @Chloe Did you get any solution? I am looking for the some solution for my questions https://stackoverflow.com/questions/62414096/due-to-incorrect-request-with-special-character-and-spring-framework-throw-f Which is an almost a similar type of your question. – Neel Jun 17 '20 at 15:08

0 Answers0