Server version (in http header)

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Server version (in http header)

Venkat Bommakanti

Hi,

Is there a way to override the "CherryPy/2.2.1" string
used in the HTTP "Server" header field, so basically
it can reflect "my-web-app name/ver" rather than the
fact that the web-app is served by CP.

Can change CP sources, but wondering if there is a
config override. Looked in CP docs, but to no avail.

Thanks,
/venkat


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups-beta.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Server version (in http header)

Robert Brewer
> Is there a way to override the "CherryPy/2.2.1" string
> used in the HTTP "Server" header field, so basically
> it can reflect "my-web-app name/ver" rather than the
> fact that the web-app is served by CP.
>
> Can change CP sources, but wondering if there is a
> config override. Looked in CP docs, but to no avail.

This response header is set to its default quite early in the request/response process, so you just need to find a point at which to change it. You can do that in each page handler, of course, but that gets tedious. CherryPy 3 has a response_headers Tool that you can easily turn on in config:

    tools.response_headers.on = True
    tools.response_headers.headers = [('Server', 'my-web-app name/ver')]

For CherryPy 2, you should be able to write a similar filter.


Robert Brewer
System Architect
Amor Ministries
[hidden email]


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups-beta.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---

winmail.dat (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Server version (in http header)

Sylvain Hellegouarch

Robert Brewer wrote:

>> Is there a way to override the "CherryPy/2.2.1" string
>> used in the HTTP "Server" header field, so basically
>> it can reflect "my-web-app name/ver" rather than the
>> fact that the web-app is served by CP.
>>
>> Can change CP sources, but wondering if there is a
>> config override. Looked in CP docs, but to no avail.
>
> This response header is set to its default quite early in the request/response process, so you just need to find a point at which to change it. You can do that in each page handler, of course, but that gets tedious. CherryPy 3 has a response_headers Tool that you can easily turn on in config:
>
>     tools.response_headers.on = True
>     tools.response_headers.headers = [('Server', 'my-web-app name/ver')]
>
> For CherryPy 2, you should be able to write a similar filter.

Indeed, CherryPy already has such a filter:
http://www.cherrypy.org/browser/tags/cherrypy-2.2.1/cherrypy/test/test_response_headers_filter.py

- Sylvain

--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups-beta.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---