You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Richard Čepas <rc...@richard.eu.org> on 2002/01/13 15:39:26 UTC

Unsetting standard response headers?

Hi,

I have noticed that Yahoo uses Location: header only for redirect responses and thought it may be good to save half of the bandwidth and do the same, as my particular script/server is serving redirects mostly.
So my question is how to unset Date:, Server: and Content-Type: response headers?  mod_headers and 'Header unset' doesn't work for some reason, maybe it is possible to use some Perl*Handler?



-- 
      ☻ Ričardas Čepas ☺

Re: Unsetting standard response headers?

Posted by Igor Sysoev <is...@rambler-co.ru>.
On Sun, 13 Jan 2002, Perrin Harkins wrote:

> > I have noticed that Yahoo uses Location: header only for redirect
> responses and thought
> > it may be good to save half of the bandwidth and do the same, as my
> particular script/server
> > is serving redirects mostly.  So my question is how to unset Date:,
> Server: and
> > Content-Type: response headers?
> 
> Who is setting them in the first place?  If they are generated by your
> script and you don't set them, Apache will not add them.  You may be
> seeing them added for redirects that Apache does for you, like sending
> http://yoursite to http://yoursite/.  You can handle those yourself
> instead if you want to.

Apache core always sets 'Server' and 'Date' headers.
You can not simply overwrite them - you need patch Apache or use
low-level Apache API.

Igor Sysoev


Re: Unsetting standard response headers?

Posted by Perrin Harkins <pe...@elem.com>.
> I have noticed that Yahoo uses Location: header only for redirect
responses and thought
> it may be good to save half of the bandwidth and do the same, as my
particular script/server
> is serving redirects mostly.  So my question is how to unset Date:,
Server: and
> Content-Type: response headers?

Who is setting them in the first place?  If they are generated by your
script and you don't set them, Apache will not add them.  You may be
seeing them added for redirects that Apache does for you, like sending
http://yoursite to http://yoursite/.  You can handle those yourself
instead if you want to.

- Perrin


Re: Unsetting standard response headers?

Posted by Igor Sysoev <is...@rambler-co.ru>.
On Sun, 13 Jan 2002, Richard [utf-8] д▄epas wrote:

> I have noticed that Yahoo uses Location: header only for redirect responses and thought it may be good to save half of the bandwidth and do the same, as my particular script/server is serving redirects mostly.

To save bandwidth you can try mod_deflate - it gzips content like
mod_gzip does.

> So my question is how to unset Date:, Server: and Content-Type: response headers?  mod_headers and 'Header unset' doesn't work for some reason, maybe it is possible to use some Perl*Handler?

mod_headers would not help.
There are two ways to omit 'Server', 'Date' and 'Content-Type' headers:
1. to use ap_rwrite()/BUFF API to send response as mod_proxy does;
2. to patch Apache sources. This helps to all Apache modules that use
   ap_send_http_header()/'return HTTP_MOVED_*' API.
 
Igor Sysoev