Removing a header set by a proxy

Paul Dlug paul.dlug at
Thu Jul 5 20:17:43 MSD 2007

I'm using nginx to proxy some rails mongrel processes, I have a header
being returned from the rails app so I can log it with the other
information in the access log. However, I don't want this header being
return to the client. I tried proxy_hide_header but this prevents it
from being returned entirely. Some sample config is below, as you can
see I want to log the header X-Accountname come back from the rails
app and prevent this header from reaching the client.

log_format  main  '$remote_addr - $remote_user [$time_local] $request '
                        '"$status" $body_bytes_sent "$http_referer" '
                        '"$http_user_agent" "$http_x_forwarded_for"
"$request_time" "$sent_http_x_accountname" $server_name';

location /railsapp {
    proxy_pass http://rails_mongrels/railsapp;
    unset $http_x_accountname;

More information about the nginx mailing list