Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
In Tomcat (v8.5.24) an URL with a query parameter containing an unencode curly brace ("{") produces a 400 error.
You can configure Tomcat to allow it with "relaxedQueryChars". But this is not what I want. I tried to write a custom error page and add it to web.xml
<error-page>
<error-code>400</error-code>
<location>/error/error400</location>
</error-page>
But this does not work as Tomcat is really killing the request and does not process the error pages (org.apache.coyote.http11.Http11Processor:737)
It seems there is no way to handle it. Now I tried to handle it in nginx. But to handle it there I need to set "proxy_intercept_errors = on" and I don't want to intercept all error codes from my proxy.
So no luck rendering a custom 400 page in this scenario? Or is there any workaround?
I also faced to this issue and as a workaround I implemented own ErrorReportValve by extending org.apache.catalina.valves.ErrorReportValve class and configured it on my Tomcat.
To accomplish this the following article was really helpful: http://robupcraft.com/tomcat-valves/
Note that for the implementation (and successful build), you need tomcat-catalina dependency.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.