- Previous thread: Qustion for reverse-proxy for virtual host
- Next thread: proxy_pass issue
- Threads sorted by date: nginx 200910
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?
sorry for my poor english.
thanks
bb
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?
sorry for my poor english.
thanks
bb
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
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
1. why not support any header rewriting? I think this feature will
make a flexible config-file.
2. I used "server_tokens off;". thanks
2009/10/5 Maxim Dounin :
>
> 1. Directive add_header does not support arbitrary header rewriting.
>
> 2. No, you can't redefine Server header without patching code. =A0It
> 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
>
>
make a flexible config-file.
2. I used "server_tokens off;". thanks
2009/10/5 Maxim Dounin :
>
> 1. Directive add_header does not support arbitrary header rewriting.
>
> 2. No, you can't redefine Server header without patching code. =A0It
> 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
>
>
On Tue, Oct 6, 2009 at 1:03 AM, bit bull wrote:
> 1. why not support any header rewriting? =A0I think this feature will
> make a flexible config-file.
> 2. I used =A0"server_tokens off;". =A0thanks
>
Well, this could be easily done by a custom C module (implemented as
an output header filter perhaps). I'm pondering writing a Headers-More
module, which will also provide an option to manipulate headers of
pages with 4xx and 5xx status codes.
Cheers,
-agentzh
> 1. why not support any header rewriting? =A0I think this feature will
> make a flexible config-file.
> 2. I used =A0"server_tokens off;". =A0thanks
>
Well, this could be easily done by a custom C module (implemented as
an output header filter perhaps). I'm pondering writing a Headers-More
module, which will also provide an option to manipulate headers of
pages with 4xx and 5xx status codes.
Cheers,
-agentzh
thanks for your help~ Headers-More module looks very useful.
2009/10/6 agentzh :
> On Tue, Oct 6, 2009 at 1:03 AM, bit bull wrote:
>> 1. why not support any header rewriting? =A0I think this feature will
>> make a flexible config-file.
>> 2. I used =A0"server_tokens off;". =A0thanks
>>
>
> Well, this could be easily done by a custom C module (implemented as
> an output header filter perhaps). I'm pondering writing a Headers-More
> module, which will also provide an option to manipulate headers of
> pages with 4xx and 5xx status codes.
>
> Cheers,
> -agentzh
>
>
2009/10/6 agentzh :
> On Tue, Oct 6, 2009 at 1:03 AM, bit bull wrote:
>> 1. why not support any header rewriting? =A0I think this feature will
>> make a flexible config-file.
>> 2. I used =A0"server_tokens off;". =A0thanks
>>
>
> Well, this could be easily done by a custom C module (implemented as
> an output header filter perhaps). I'm pondering writing a Headers-More
> module, which will also provide an option to manipulate headers of
> pages with 4xx and 5xx status codes.
>
> Cheers,
> -agentzh
>
>
On Tue, Oct 6, 2009 at 8:10 PM, bit bull wrote:
> thanks for your help~ Headers-More module looks very useful.
>
I'll look into it after I finished my nginx-echo-module in the next
few days. I'd also turn it into a patch to the standard headers module
if Igor and others like it.
Stay tuned!
-agentzh
> thanks for your help~ Headers-More module looks very useful.
>
I'll look into it after I finished my nginx-echo-module in the next
few days. I'd also turn it into a patch to the standard headers module
if Igor and others like it.
Stay tuned!
-agentzh
I think Igor and others will like it.haha~
BTW: What's the echo-module?
2009/10/7 agentzh :
> On Tue, Oct 6, 2009 at 8:10 PM, bit bull wrote:
>> thanks for your help~ Headers-More module looks very useful.
>>
>
> I'll look into it after I finished my nginx-echo-module in the next
> few days. I'd also turn it into a patch to the standard headers module
> if Igor and others like it.
>
> Stay tuned!
> -agentzh
>
>
BTW: What's the echo-module?
2009/10/7 agentzh :
> On Tue, Oct 6, 2009 at 8:10 PM, bit bull wrote:
>> thanks for your help~ Headers-More module looks very useful.
>>
>
> I'll look into it after I finished my nginx-echo-module in the next
> few days. I'd also turn it into a patch to the standard headers module
> if Igor and others like it.
>
> Stay tuned!
> -agentzh
>
>
On Wed, Oct 7, 2009 at 1:42 PM, bit bull wrote:
> I think Igor and others will like it.haha~
>
:)
> BTW: What's the echo-module?
>
A simple module that lets nginx to echo things directly just like a
classic CGI script (but without CGI or Perl of course):
http://github.com/agentzh/echo-nginx-module
Currently only "echo" and "echo_client_request_headers" directives are
supported. I'm working on "echo_sleep" (a non-blocking sleep on the
server side) directively atm. "echo_location" and filter versions of
"echo_before_body" and "echo_after_body" are also on my TODO list.
Cheers,
-agentzh
> I think Igor and others will like it.haha~
>
:)
> BTW: What's the echo-module?
>
A simple module that lets nginx to echo things directly just like a
classic CGI script (but without CGI or Perl of course):
http://github.com/agentzh/echo-nginx-module
Currently only "echo" and "echo_client_request_headers" directives are
supported. I'm working on "echo_sleep" (a non-blocking sleep on the
server side) directively atm. "echo_location" and filter versions of
"echo_before_body" and "echo_after_body" are also on my TODO list.
Cheers,
-agentzh
oh~so interesting!
2009/10/8 agentzh :
> On Wed, Oct 7, 2009 at 1:42 PM, bit bull wrote:
>> I think Igor and others will like it.haha~
>>
>
> :)
>
>> BTW: What's the echo-module?
>>
>
> A simple module that lets nginx to echo things directly just like a
> classic CGI script (but without CGI or Perl of course):
>
> =A0 http://github.com/agentzh/echo-nginx-module
>
> Currently only "echo" and "echo_client_request_headers" directives are
> supported. I'm working on "echo_sleep" (a non-blocking sleep on the
> server side) directively atm. "echo_location" and filter versions of
> "echo_before_body" and "echo_after_body" are also on my TODO list.
>
> Cheers,
> -agentzh
>
>
2009/10/8 agentzh :
> On Wed, Oct 7, 2009 at 1:42 PM, bit bull wrote:
>> I think Igor and others will like it.haha~
>>
>
> :)
>
>> BTW: What's the echo-module?
>>
>
> A simple module that lets nginx to echo things directly just like a
> classic CGI script (but without CGI or Perl of course):
>
> =A0 http://github.com/agentzh/echo-nginx-module
>
> Currently only "echo" and "echo_client_request_headers" directives are
> supported. I'm working on "echo_sleep" (a non-blocking sleep on the
> server side) directively atm. "echo_location" and filter versions of
> "echo_before_body" and "echo_after_body" are also on my TODO list.
>
> Cheers,
> -agentzh
>
>
On Mon, Oct 5, 2009 at 4:11 PM, bit bull wrote:
> hi,all:
>
> =A0 =A0hello, I config "add_header Server xxxx;", then I get response hea=
der:
>
> < 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.
The "more_set_headers" of the "headers_more" module will work the way
that you expect now:
more_set_headers 'Server: xxxx';
Also, it applies to all the status code by default, unlike the
standard "headers" module. Use the -s option of the "more_set_headers"
directive if you want more control over it ;)
See http://github.com/agentzh/headers-more-nginx-module for more details.
Cheers,
-agentzh
> hi,all:
>
> =A0 =A0hello, I config "add_header Server xxxx;", then I get response hea=
der:
>
> < 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.
The "more_set_headers" of the "headers_more" module will work the way
that you expect now:
more_set_headers 'Server: xxxx';
Also, it applies to all the status code by default, unlike the
standard "headers" module. Use the -s option of the "more_set_headers"
directive if you want more control over it ;)
See http://github.com/agentzh/headers-more-nginx-module for more details.
Cheers,
-agentzh
Related Threads
- Expert - ldconfig bug? - mandriva
- PATCH 2/2 - msvcr90: Forward _calloc_crt to calloc - wine
- xml - XML Schema, unique and namespaces - libxml
- PATCH 1/6 - WineDbg - : fix buffer size for 8-byte watchpoint - wine
- Cricket wireless broadband USB modem - ubuntu
- rtmpdump - 2.2 install failure - macports
- Terminal type?? - fedora
- PATCH 3/5 - msvcrt: Added strncpy_s implementation - wine
- CMS - cakephp
- Installation queries - freebsd
- install-discuss - Opensolaris 0906 installation fails - freezes at 24%; 26% ... progress - opensolaris