For some security reasons, you must set the X-Powered-By header to an empty string. I am trying to set the header to a filter, but when I look at the headers in Firebug, I see that the custom header value set by my filter is added by JSF / 1.2.
The filter is the first in the query chain and implicitly the last in the response chain. Below is an example of the code that I wrote in the doFilter method.
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException,
ServletException {
HttpServletResponse httpResponse = (HttpServletResponse) response;
httpResponse.setHeader("X-Powered-By","");
chain.doFilter(request, response);
}
Am uses Tomcat 6. Since my filter is the last in the response chain, does tomcat set this header again after the control returns to the tomcat connector?
How to override this value for my custom value?
source
share