List Info

Thread: Server version (in http header)




Server version (in http header)
user name
2006-12-07 06:14:08
> 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
fumanchuamor.org


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

-~----------~----~----~----~------~----~------~--~---
Server version (in http header)
user name
2006-12-07 07:32:28
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.cher
rypy.org/browser/tags/cherrypy-2.2.1/cherrypy/test/test_resp
onse_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 cherrypy-usersgooglegroups.com
To unsubscribe from this group, send email to
cherrypy-users-unsubscribegooglegroups.com
For more options, visit this group at http://groups-beta.google.com/group/cherrypy-users?hl=en

-~----------~----~----~----~------~----~------~--~---

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )