Hello!
On Fri, Aug 9, 2013 at 2:05 AM, peter sabaini wrote:
> thanks for the suggestion. I tested that --  I can see other upstream* variables being passed along, but the X-Foo test header I set from the X-Accel-Redirect responder doesn't show...
>
The $upstream_http_HEADER variable should work with X-Accel-Redirect,
but your configuration does not work because you configured another
proxy_pass in location ~ '/internal/stuff', which overrides the
$upstream_http_HEADER variable values generated in your original
location (also with ngx_proxy). To make this work, you need a
"intermediate location" that saves the original value of
$upstream_http_HEADER. Below is a complete example that demonstrates
this and it has been tested on my side:
    location = /a1 {
        proxy_pass http://127.0.0.1:$server_port/a2;
    }
    location = /a2 {
        more_set_headers 'X-Accel-Redirect: /internal/stuff';
        more_set_headers 'X-Foo: foobar';
        echo ok;
    }
    location ~ '/internal/stuff' {
        internal;
        set $x_foo $upstream_http_x_foo;
        rewrite ^ /a3;
    }
    location = /a3 {
        proxy_set_header X-Foo $x_foo;
        proxy_pass http://127.0.0.1:$server_port/a4;
    }
    location = /a4 {
        echo "X-Foo: $http_x_foo";
    }
And accessing /a1 gives
    $ curl localhost:1985/a1
    X-Foo: foobar
So we're getting the expected value :) Please note that how we saved
the value of $upstream_http_x_foo into our own user variable $x_foo in
location ~ '/internal/stuff' and later use it in location = /a3.
To conclude, the $upstream_http_HEADER variable is one of those
special built-in Nginx variables that are context-sensitive. Ensure
that you are not using a new Nginx upstream module configuration when
you still need the info in a previous nginx upstream module
configuration.
Best regards,
-agentzh