proxy_hide_header hiding header from ALL locations

Maxim Dounin mdounin at
Fri Jul 30 23:53:02 MSD 2010


On Wed, Jul 28, 2010 at 02:47:28PM -0700, W. Andrew Loe III wrote:

> It looks like Content-Type is special cased:
> Changes with nginx 0.3.58                                        14 Aug 2006
>     *) Feature: the "error_page" directive supports the variables.
>     *) Change: now the procfs interface instead of sysctl is used on Linux.
>     *) Change: now the "Content-Type" header line is inherited from first
>        response when the "X-Accel-Redirect" was used.
> How can I get this behavior for ETag and Last-Modified as well?

Aha, now it's clear that you want to inherit some headers from 
original response with X-Accel-Redirect.  Here is the solution:

    location ... {
        set $x $upstream_http_...;
        add_header Something $x;

        proxy_pass ...

Note that you have to use extra "set" to preserve 
$upstream_http_... variable from original response.

Maxim Dounin

More information about the nginx mailing list