# Variables disallowed in first proxy\_redirect parameter?

**URL:** <https://www.ruby-forum.com/t/variables-disallowed-in-first-proxy-redirect-parameter/180396>\
**Category:** NGINX\
**Created:** [December 19, 2009, 3:25pm UTC](https://www.ruby-forum.com/t/variables-disallowed-in-first-proxy-redirect-parameter/180396 "2009-12-19T15:25:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![xamdam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/d78d45/32.png) [@xamdam](https://www.ruby-forum.com/u/xamdam)\
**Post date:** [December 19, 2009, 3:25pm UTC](https://www.ruby-forum.com/t/variables-disallowed-in-first-proxy-redirect-parameter/180396/1 "2009-12-19T15:25:20Z")

</div>

Hello all,

Is it not possible to use variables in the first parameter to  
proxy\_redirect directive? I ran some experiments and it seems that  
given the following two configurations, only the second one works,  
even though $host == “[site.domain.com](http://site.domain.com)”:

proxy\_redirect http://$host/ https://$host/;  
proxy\_redirect [http://site.domain.com/](http://site.domain.com/) https://$host/;

I’ve looked at the Location headers being returned in both cases, so I  
know what $host is set to in the second (working) example.  
Furthermore, I also tried this config:

set $myhost [site.domain.com](http://site.domain.com);  
proxy\_redirect http://$myhost/ https://$myhost/;  
proxy\_redirect [http://site.domain.com/](http://site.domain.com/) https://$myhost/;

Same result - only the second version works. Is this a bug or by design?

- Max

---

<div class="post-metadata">

**Author:** ![xamdam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/d78d45/32.png) [@xamdam](https://www.ruby-forum.com/u/xamdam)\
**Post date:** [December 19, 2009, 3:25pm UTC](https://www.ruby-forum.com/t/variables-disallowed-in-first-proxy-redirect-parameter/180396/2 "2009-12-19T15:25:21Z")

</div>

Hello!

On Mon, Nov 23, 2009 at 01:36:58PM -0500, Maxim K. wrote:

> Hello all,
> 
> Is it not possible to use variables in the first parameter to  
> proxy\_redirect directive? I ran some experiments and it seems that  
> given the following two configurations, only the second one works,  
> even though $host == “[site.domain.com](http://site.domain.com)”:

Variables allowed only in replacement part.

Maxim D.
