qaware / x-forwarded-filter Goto Github PK
View Code? Open in Web Editor NEWx-forwared filter for the masses
License: Apache License 2.0
x-forwared filter for the masses
License: Apache License 2.0
Hi,
When an error causes the webapp to use the page defined in the error-page tag in web.xml, this filter doesn't try to handle the error dispatch.
I believe this is due to the code in OncePerRequestFilter.java:
/**
* Whether to filter error dispatches such as when the servlet container
* processes and error mapped in {@code web.xml}. The default return value
* is "true", which means the filter will not be invoked in case of an error
* dispatch.
*
* @since 3.2
*/
protected boolean shouldNotFilterErrorDispatch() {
return true;
}
Changing that to false fixes the issue for me.
Another option is to override shouldNotFilterErrorDispatch in ForwardedHeaderFilter.java if the desire is to preserve OncePerRequestFilter (which appears to come from Spring).
You made a great job, thank you. Unfortunately I can't use your filter and I need to use Tomcat's RemoteIpValve. What I especially need is to populate request.serverName from X-Forwarded-Host.
And I found a ticket with a patch in Bug 57665 - support x-forwarded-host
There in comment I described my situation and why I can't use your filter.
I checked that patch and code of whole RemoteIpValve and I think it can be significantly improved.
At least it would be great if it can support Forwarded
header.
Unfortunately ATM I don't enough time to send to Tomcat a new patch but first of all I would like to ask you to contribute as a person who knows better how to implement this.
Can you help with this?
Thank you in advance
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.