Hide Headers in Passenger/Nginx Server
I am trying to hide this headers for the production server but without succe开发者_开发问答ss :
X-Powered-By: Phusion Passenger (mod_rails/mod_rack) 3.0.7
X-Runtime: 0.021429
Server: nginx/1.0.0 + Phusion Passenger 3.0.7 (mod_rails/mod_rack)
Using :
- Rails 3.0.9
- Passenger 3.0.7
- Nginx 1.0.0
Any ideas ?
To remove nginx Server:
header you could use server_tokens off
directive.
For other headers try using Headers More nginx module:
more_set_headers 'Server: anon'; # replace the default 'nginx + Passenger'
more_set_headers 'X-Powered-By'; # clear header entirely
It possible to hide passenger headers, but require specific configuration. Something like this should work:
External world faced part:
upstream x {
server your-server:8040;
}
server {
server_name your-domain;
# ...
location / {
# ...
proxy_hide_header X-Powered-By;
proxy_hide_header X-Runtime;
proxy_pass http://x;
}
}
Passenger powered site:
server {
server_name local-site;
listen 8040 default_server;
location / {
passenger_enabled on;
# regular site configuration
}
}
local-site
can be on same nginx with your-domain
part, but this, probably, slight slow down request handling.
精彩评论