Welcome! Log In Create A New Profile

Advanced

Re: A question about add_header replication

Maxim Dounin
October 05, 2009 12:00PM
Hello!

On Mon, Oct 05, 2009 at 04:11:53PM +0800, bit bull wrote:

> hi,all:
>
> hello, I config "add_header Server xxxx;", then I get response header:
>
> < HTTP/1.1 200 OK
> < Server: nginx/0.8.17
> < Date: Mon, 05 Oct 2009 07:59:18 GMT
> < Content-Type: text/html
> < Content-Length: 151
> < Last-Modified: Mon, 05 Oct 2009 07:24:51 GMT
> < Connection: keep-alive
> < Server: xxxx
> < Accept-Ranges: bytes
>
> We can see Server field is printed twice. I need replace first one.
>
> So I read source code, found:
>
> 1.add_header is simple push to header_out array, keep
> headers_out.server == NULL.
> 2. "Server:nginx/0.8.17" field is setted at http_header_filter_module.c:457
> 3. a loop start at http_header_filter_module.c:568, it concat all
> header fields(include "Server xxxx").
> 4. Server field is replication.
>
> why not set headers_out.server at add_header? how to implement my need?

1. Directive add_header does not support arbitrary header rewriting.

2. No, you can't redefine Server header without patching code. It
isn't considered to be good thing to do, but for those who still
thinks that hiding head in sand is a good way to handle security
there is directive "server_tokens off;" which will hide version
string from Server header and standard error pages.

Maxim Dounin
Subject Author Posted

A question about add_header replication

bit bull October 05, 2009 04:16AM

Re: A question about add_header replication

Maxim Dounin October 05, 2009 12:00PM

Re: A question about add_header replication

bit bull October 05, 2009 01:10PM

Re: A question about add_header replication

agentzh October 05, 2009 09:26PM

Re: A question about add_header replication

bit bull October 06, 2009 08:18AM

Re: A question about add_header replication

agentzh October 06, 2009 10:28PM

Re: A question about add_header replication

bit bull October 07, 2009 01:48AM

Re: A question about add_header replication

agentzh October 07, 2009 10:26PM

Re: A question about add_header replication

bit bull October 08, 2009 11:38PM

Re: A question about add_header replication

agentzh November 17, 2009 05:18AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 294
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready