FAForever/faf-java-api

Send 404 instead of 500 for NoResourceFoundException

Closed this issue · 0 comments

The log gets spammed a lot with some weird scan for vulnerabilities. This should return 404 not 500 and not appear in logs.

  • HttpRequestMethodNotSupportedException
  • NoResourceFoundException
 2024-01-11 09:36:14.031  WARN 1 --- [32667d2c-4b19-45c2-a7e1-250c58f1db34] [o-8010-exec-274] c.f.a.e.GlobalControllerExceptionHandler : Internal server error

 org.springframework.web.servlet.resource.NoResourceFoundException: No static resource login/xmlrpc.php.
 	at org.springframework.web.servlet.resource.ResourceHttpRequestHandler.handleRequest(ResourceHttpRequestHandler.java:585)
 	at org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter.handle(HttpRequestHandlerAdapter.java:52)
 	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1089)
...
2024-01-06 20:55:31.694  WARN 1 --- [0c9c2c20-3562-47f9-b00d-ef03998397fe] [io-8010-exec-43] c.f.a.e.GlobalControllerExceptionHandler : Internal server error
 org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'GET' is not supported