Skip to content
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

Whitelabeled error page stopped working in 2.6.0 #28770

Closed
lukas-krecan opened this issue Nov 22, 2021 · 2 comments
Closed

Whitelabeled error page stopped working in 2.6.0 #28770

lukas-krecan opened this issue Nov 22, 2021 · 2 comments
Labels
status: invalid An issue that we don't feel is valid

Comments

@lukas-krecan
Copy link

After upgrading to Spring Boot 2.6.0 default white-labeled error page stopped working. We are using Spring MVC for REST endpoints and when a user accesses a URL that is not mapped to a controller, he just gets 404 with no HTML, in previous version he got an error page.

We actually have custom ErrorAttributes implementation to override the response, but the change in the behavior is there even without the customization. I did not have much time to debug it, but it seems that the redirect to /error does not happen in the new version. Maybe it's an intentional change, but I could not find it anywhere in the release notes.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Nov 22, 2021
@wilkinsona
Copy link
Member

You haven't mentioned Spring Security, but this could be due #26356 and your security configuration or a duplicate of #28759. If it's the former, when the URL that the user tries to access is secured and they haven't provided any credentials, the error response will no longer include a body. This is intentional and can be addressed by adjusting your security configuration. If that doesn't sound like it fits your app and you suspect it's the latter, can you please provide a small sample that reproduces the behaviour you've described? You can share it with us by zipping it up and attaching it to this issue or by pushing it to a separate repository on GitHub.

@wilkinsona wilkinsona added the status: waiting-for-feedback We need additional information before we can continue label Nov 22, 2021
@lukas-krecan
Copy link
Author

lukas-krecan commented Nov 22, 2021

Thanks. It's indeed caused by spring security #26356. The reason is that we are doing authentication using a subclass of OncePerRequestFilter which does not fill SecurityContext for error dispatch.

@wilkinsona wilkinsona added status: invalid An issue that we don't feel is valid and removed status: waiting-for-feedback We need additional information before we can continue status: waiting-for-triage An issue we've not yet triaged labels Nov 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: invalid An issue that we don't feel is valid
Projects
None yet
Development

No branches or pull requests

3 participants