Removing a header set by a proxy

Igor Sysoev is at
Thu Jul 5 20:36:02 MSD 2007

On Thu, Jul 05, 2007 at 12:17:43PM -0400, Paul Dlug wrote:

> 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';
+ "$request_time" "$upstream_http_x_accountname" $server_name';

> location /railsapp {
>    proxy_pass http://rails_mongrels/railsapp;

-    unset $http_x_accountname;
+    proxy_hide_header  x-accountname;

> }

Igor Sysoev

More information about the nginx mailing list