Is it possible to get headers from X-Accel-Redirect reply

mayamatakeshi mayamatakeshi at gmail.com
Sat Nov 28 01:10:19 UTC 2015


On Sat, Nov 28, 2015 at 9:17 AM, mayamatakeshi <mayamatakeshi at gmail.com>
wrote:

> Hello, my upstream server replies with this:
>
> HTTP/1.1 200 OK.
> Server: test.
> Date: Sat, 28 Nov 2015 00:05:55 GMT.
> Content-Type: application/json.
> Content-Length: 0.
> Connection: close.
> X-ExtraInfo: domain_name=test1.com
> ;domain_id=1000;user_name=user1;user_id=10001001.
> X-Accel-Redirect: /internal_redirect/192.168.2.153:7777.
> Access-Control-Allow-Origin: https://192.168.2.153:445.
> Access-Control-Allow-Credentials: true.
>
> which I handle with this:
>
> location ~ ^/internal_redirect/(.*) {
>     internal;
>     proxy_pass http://$1$is_args$args;
> }
>
> However, I want to pass X-ExtraInfo to the target upstream server so i
> tried:
>   proxy_set_header               X-ExtraInfo
> $sent_http_x_extrainfo;
> and even:
>   proxy_set_header               X-ExtraInfo
> $http_x_extrainfo;
> but none of them worked.
> So, is there a way to get headers from X-Accel-Redirect replies?
>
> Obs: I can workaround this passing the ExtraInfo as arguments in the
> target URL but I want try to rely on the current interface of the target
> upstream server.
>
>
Hello,
I have found the solution in the openresty google group:
https://groups.google.com/d/msg/openresty-en/vPxQFntAfCc/VcCv1bhLeLsJ
Regards,
Takeshi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20151128/76000e77/attachment.html>


More information about the nginx mailing list