You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Sander Smith <ss...@rogers.com> on 2004/09/12 22:01:45 UTC

Changing the server name in response headers

I'm sure this is simple, I just can't figure out how to do it. I want to 
change the name (type) of the server that gets returned in the HTTP 
response header. Currently it is returning Apache-Coyote XX, but I'd rather 
it return something more meaningful for me. How do I do this?

I grepped through the Tomcat source code, and found that it calls

response.addHeader("Server", "Apache- Coyote");

I tried adding my own similar header, but that didn't work. I guess Tomcat 
gets to it last and probably wins because of that. I couldn't see any other 
way of overcoming this. Anyone have any ideas?? Maybe there's some 
configuration option, or preferably some programmatic way to do this.

Sander Smith



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


Re: Changing the server name in response headers

Posted by Tim Funk <fu...@joedog.org>.
It can't be done without recompiling the source.

-Tim

Sander Smith wrote:
> I'm sure this is simple, I just can't figure out how to do it. I want to 
> change the name (type) of the server that gets returned in the HTTP 
> response header. Currently it is returning Apache-Coyote XX, but I'd 
> rather it return something more meaningful for me. How do I do this?
> 
> I grepped through the Tomcat source code, and found that it calls
> 
> response.addHeader("Server", "Apache- Coyote");
> 
> I tried adding my own similar header, but that didn't work. I guess 
> Tomcat gets to it last and probably wins because of that. I couldn't see 
> any other way of overcoming this. Anyone have any ideas?? Maybe there's 
> some configuration option, or preferably some programmatic way to do this.
> 


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


RE: Changing the server name in response headers

Posted by Mark Thomas <ma...@apache.org>.
From: Sander Smith [mailto:ssmith3988@rogers.com] 
> Thanks for your answer, although you really didn't answer my 
> question. To 
> get this functionality do I just need to set the header and 
> it should work? 

Yes

> Was that the bug that you fixed, that you were overriding 
> something that 
> was previously set? I am using Tomcat 5.0.24.

Sort of. What was happening was that two server headers were being sent.

Mark



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


RE: Changing the server name in response headers

Posted by Sander Smith <ss...@rogers.com>.
Hi Mark,

Thanks for your answer, although you really didn't answer my question. To 
get this functionality do I just need to set the header and it should work? 
Was that the bug that you fixed, that you were overriding something that 
was previously set? I am using Tomcat 5.0.24.

Sander

At 09:27 PM 9/12/2004 +0100, you wrote:
>This has been fixed quite recently. The fix is in 5.5.0 branch. Having checked
>CVS, I forgot to back port the patch to the 4.1.x/5.0.x branch. I'll do this
>now.
>
>Mark
>
> > -----Original Message-----
> > From: Sander Smith [mailto:ssmith3988@rogers.com]
> > Sent: Sunday, September 12, 2004 9:02 PM
> > To: tomcat-user@jakarta.apache.org
> > Subject: Changing the server name in response headers
> >
> > I'm sure this is simple, I just can't figure out how to do
> > it. I want to
> > change the name (type) of the server that gets returned in the HTTP
> > response header. Currently it is returning Apache-Coyote XX,
> > but I'd rather
> > it return something more meaningful for me. How do I do this?
> >
> > I grepped through the Tomcat source code, and found that it calls
> >
> > response.addHeader("Server", "Apache- Coyote");
> >
> > I tried adding my own similar header, but that didn't work. I
> > guess Tomcat
> > gets to it last and probably wins because of that. I couldn't
> > see any other
> > way of overcoming this. Anyone have any ideas?? Maybe there's some
> > configuration option, or preferably some programmatic way to do this.
> >
> > Sander Smith
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> >
> >
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org



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


RE: Changing the server name in response headers

Posted by Mark Thomas <ma...@apache.org>.
This has been fixed quite recently. The fix is in 5.5.0 branch. Having checked
CVS, I forgot to back port the patch to the 4.1.x/5.0.x branch. I'll do this
now.

Mark

> -----Original Message-----
> From: Sander Smith [mailto:ssmith3988@rogers.com] 
> Sent: Sunday, September 12, 2004 9:02 PM
> To: tomcat-user@jakarta.apache.org
> Subject: Changing the server name in response headers
> 
> I'm sure this is simple, I just can't figure out how to do 
> it. I want to 
> change the name (type) of the server that gets returned in the HTTP 
> response header. Currently it is returning Apache-Coyote XX, 
> but I'd rather 
> it return something more meaningful for me. How do I do this?
> 
> I grepped through the Tomcat source code, and found that it calls
> 
> response.addHeader("Server", "Apache- Coyote");
> 
> I tried adding my own similar header, but that didn't work. I 
> guess Tomcat 
> gets to it last and probably wins because of that. I couldn't 
> see any other 
> way of overcoming this. Anyone have any ideas?? Maybe there's some 
> configuration option, or preferably some programmatic way to do this.
> 
> Sander Smith
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 



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