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

**URL:** <https://www.ruby-forum.com/t/is-it-possible-to-get-headers-from-x-accel-redirect-reply/243537>\
**Category:** NGINX\
**Created:** [December 2, 2015, 8:56am UTC](https://www.ruby-forum.com/t/is-it-possible-to-get-headers-from-x-accel-redirect-reply/243537 "2015-12-02T08:56:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rafa\_F](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/958977/32.png) [@Rafa\_F](https://www.ruby-forum.com/u/Rafa_F)\
**Post date:** [December 2, 2015, 8:56am UTC](https://www.ruby-forum.com/t/is-it-possible-to-get-headers-from-x-accel-redirect-reply/243537/1 "2015-12-02T08:56:13Z")

</div>

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](http://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](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.

Regards,  
Takeshi

---

<div class="post-metadata">

**Author:** ![mayamatakeshi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a8b319/32.png) [@mayamatakeshi](https://www.ruby-forum.com/u/mayamatakeshi)\
**Post date:** [December 2, 2015, 9:09am UTC](https://www.ruby-forum.com/t/is-it-possible-to-get-headers-from-x-accel-redirect-reply/243537/2 "2015-12-02T09:09:05Z")

</div>

On Sat, Nov 28, 2015 at 9:17 AM, mayamatakeshi [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> X-Accel-Redirect: /internal\_redirect/192.168.2.153:7777.  
> However, I want to pass X-ExtraInfo to the target upstream server so i  
> 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:

> **[X-Accel-Redirect dropping custom headers](https://groups.google.com/g/openresty-en/c/vPxQFntAfCc/m/VcCv1bhLeLsJ)**

Regards,  
Takeshi
