You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Ian Stevens <ia...@phantomfiber.com> on 2004/07/05 17:19:38 UTC

RE: Using javax.servlet.Filter to alter HTTP headers (was RE: How can the Server header in an HTTP response be customised?)

> > Is it possible to programmatically change the Server header?  
> > Barring that, is it possible to set a Server header for a servlet 
> > within its web.xml file? My least preferred method is to change the
Server 
> > header within Tomcat's server.xml file.
> I was thinking that a javax.servlet.Filter which intercepts a 
> call to set an HTTP header would do the trick.  I wrote a 
> naive Filter (listed below) and added parameters to my 
> web.xml (also shown below) to accomplish this.  Its
> init() and doFilter() methods are called, but the setHeader() 
> method of the HttpServletResponseWrapper is never hit.

I also overrode the addHeader() method and added a call to that within my
servlet.  The addHeader() method in the wrapper gets called, but only when
that method is called within the servlet, not from within Tomcat.

Surely there is a way to alter the Server header of an HTTP response, if
only for security reasons.  I can't be the only person who wishes to do
this.  I would appreciate any suggestions as to how this can be
accomplished.

thank you,
Ian.


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: Using javax.servlet.Filter to alter HTTP headers (was RE: How can the Server header in an HTTP response be customised?)

Posted by Ian Stevens <ia...@phantomfiber.com>.
> Unless there is a PATCH in bugzilla, then no.

OK. Thanks for your help, Tim.

Ian.


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Using javax.servlet.Filter to alter HTTP headers (was RE: How can the Server header in an HTTP response be customised?)

Posted by Tim Funk <fu...@joedog.org>.
Unless there is a PATCH in bugzilla, then no.

-Tim

Ian Stevens wrote:

>>The Server header is hardcoded into the Connectors. You can't 
>>remove/change it without a PATCH/recompile to 
>>org.apache.coyote.http11.Constants
> 
> 
> That's certainly what I saw when looking at the source.  There's no way
> alter it using a javax.servlet.Filter and a
> javax.servlet.HttpServletResponseWrapper?  I tried (see previous messages on
> this topic) but got nowhere fast.
> 
> Are there plans to allow the Server header to be altered in the near future?
> It is certainly a feature I would like to see, both for reasons of security
> and for limiting the size of the HTTP header for small devices on a rate
> plan.
>  

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: Using javax.servlet.Filter to alter HTTP headers (was RE: How can the Server header in an HTTP response be customised?)

Posted by Ian Stevens <ia...@phantomfiber.com>.
> The Server header is hardcoded into the Connectors. You can't 
> remove/change it without a PATCH/recompile to 
> org.apache.coyote.http11.Constants

That's certainly what I saw when looking at the source.  There's no way
alter it using a javax.servlet.Filter and a
javax.servlet.HttpServletResponseWrapper?  I tried (see previous messages on
this topic) but got nowhere fast.

Are there plans to allow the Server header to be altered in the near future?
It is certainly a feature I would like to see, both for reasons of security
and for limiting the size of the HTTP header for small devices on a rate
plan.

Ian.




---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Using javax.servlet.Filter to alter HTTP headers (was RE: How can the Server header in an HTTP response be customised?)

Posted by Tim Funk <fu...@joedog.org>.
The Server header is hardcoded into the Connectors. You can't remove/change 
it without a PATCH/recompile to org.apache.coyote.http11.Constants


-Tim

Ian Stevens wrote:

>>>>Is it possible to programmatically change the Server header?  
> 
> [...]
> 
>>Surely there is a way to alter the Server header of an HTTP 
>>response, if only for security reasons.  I can't be the only 
>>person who wishes to do this.  I would appreciate any 
>>suggestions as to how this can be accomplished.
> 
> 
> Is there another Tomcat mailing list where I can get my question answered,
> preferably one where Tomcat developers lurk?  Nobody here seems to be able
> to provide answers.
>  

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: Using javax.servlet.Filter to alter HTTP headers (was RE: How can the Server header in an HTTP response be customised?)

Posted by Ian Stevens <ia...@phantomfiber.com>.
> > > Is it possible to programmatically change the Server header?  
[...]
> Surely there is a way to alter the Server header of an HTTP 
> response, if only for security reasons.  I can't be the only 
> person who wishes to do this.  I would appreciate any 
> suggestions as to how this can be accomplished.

Is there another Tomcat mailing list where I can get my question answered,
preferably one where Tomcat developers lurk?  Nobody here seems to be able
to provide answers.

thank you,
Ian.


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org