Hello!
On Wed, Oct 16, 2013 at 8:31 AM, Filipe Bernardo wrote:
> My question is: Is it possible to "drop" completly the server header
> "introduced" by the PHP engine?
>
Yes, it should work.
> I have this in the configuration:
> - more_set_headers 'Server: myserver'
> - more_clear_headers 'X-Powered-By'
>
> And in the tests i've done the Server header is changed, nice!
> but the 'X-Powered-By' is not entirely cleared, because it still apears only
> empty.
Ensure that you're using the latest version of ngx_headers_more and
nginx. You didn't mention the version of software you're using.
I've tried the following minimal example on my side and it works as expected:
location = /back {
content_by_lua '
ngx.header["X-Powered-By"] = "php"
ngx.say("hello")
';
}
location = /t {
proxy_pass http://127.0.0.1:$server_port/back;
more_clear_headers X-Powered-By;
}
Accessing /t gives
$ curl -i localhost:8080/t
HTTP/1.1 200 OK
Server: nginx/1.5.3
Date: Wed, 16 Oct 2013 20:27:01 GMT
Content-Type: text/plain
Content-Length: 6
Connection: keep-alive
hello
Without the "more_clear_headers X-Powered-By;" line in our
configuration above, we get
$ curl -i localhost:8080/t
HTTP/1.1 200 OK
Server: nginx/1.5.3
Date: Wed, 16 Oct 2013 20:29:36 GMT
Content-Type: text/plain
Content-Length: 6
Connection: keep-alive
X-Powered-By: php
hello
Here we use ngx_lua to emulate a PHP interface and we use ngx_proxy to
emulate the ngx_fastcgi module.
BTW, I'm cc'ing the openresty-en mailing list:
https://groups.google.com/group/openresty-en
You're highly recommended to join the list and post such questions there ;)
Best regards,
-agentzh