-
Notifications
You must be signed in to change notification settings - Fork 40.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ErrorPageFilter causes a forwarded request that sends an error to actually send a 200 OK response instead #11814
Comments
The problem here is that the |
Previously, the error page filter used sendError to set the response status when handling an exception and before forwarding the request to the error controller. Following the fix for spring-projectsgh-11814, this meant that the error controller was unable to write its response and the containers default error page was returned instead. This commit updates the error page filter to use setStatus rather than sendError. This ensures that the response has the correct status code while allowing the error controller to write its body. Tests have been added to the Tomcat deployment test suite to verify that the error page filter behaves as intended when dealing with a sent error and an exception for requests accepting HTML, JSON, or anything. Closes spring-projectsgh-12787
Question
With default servlet enabled, when deployed in an external Tomcat, the request to non-existent resource returned 200 instead of 404.
I created a demo for this problem. https://github.com/tankilo/spring-boot-problem-demo
Version Info : Spring Boot 1.5.9.RELEASE Tomcat 8.5.24
And in the log ,i found
Personal Understanding
After i debug and compare the two scenes, i find:
I am still not clear about this question, is there something wrong with the way i use springboot? -_-
The text was updated successfully, but these errors were encountered: