# Proxy\_pass redirection

**URL:** <https://www.ruby-forum.com/t/proxy-pass-redirection/242730>\
**Category:** NGINX\
**Created:** [July 22, 2015, 11:26am UTC](https://www.ruby-forum.com/t/proxy-pass-redirection/242730 "2015-07-22T11:26:11Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sadaf\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/858c86/32.png) [@Sadaf\_N](https://www.ruby-forum.com/u/Sadaf_N)\
**Post date:** [July 22, 2015, 11:26am UTC](https://www.ruby-forum.com/t/proxy-pass-redirection/242730/1 "2015-07-22T11:26:11Z")

</div>

Hi,  
I’m new to Nginx and we are using for reverse proxy.

I’m able to configured Nginx and it’s working but I’ve challenge in  
configuring it for Dynamic proxy\_pass. I’ve tried to use wild characters  
in proxy\_pass it’s not working, please help.

E.G.  
location  
server {  
#listen 443;  
listen 8080;  
#server\_name [analyticstest.isyntax.net](http://analyticstest.isyntax.net);  
server\_name IP;

/api/ingestion/ {  
proxy\_set\_header HOST $host;  
proxy\_set\_header X-Real-IP $remote\_addr;  
proxy\_buffers 8 512k;  
proxy\_buffer\_size 2024k;  
proxy\_busy\_buffers\_size 2024k;  
proxy\_read\_timeout 3000;  
add\_header Cache-Control no-cache;  
#rewrite ^/api/query/(.\*)$ /$1;  
proxy\_pass [http://IP:8881/ingestion/v1.0/streams/NGINEX](http://IP:8881/ingestion/v1.0/streams/NGINEX); (IP:  
hostname of the server where the service  
system)

In my case, in the above link last word NGINEX can be any other name, so  
how I can dynamically configure for that word.  
I tried using wild characters like \*, . & \_ are not working. Please  
help.

Thank you

---

<div class="post-metadata">

**Author:** ![puneeth](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e68b1a/32.png) [@puneeth](https://www.ruby-forum.com/u/puneeth)\
**Post date:** [July 22, 2015, 2:19pm UTC](https://www.ruby-forum.com/t/proxy-pass-redirection/242730/2 "2015-07-22T14:19:27Z")

</div>

On Wednesday, July 22, 2015 at 2:26 AM, Puneeth Kumar wrote:

> #listen 443;  
> proxy\_read\_timeout 3000;

Hi,

Add a cookie to the session and have the back end route to proper path  
post cookie check

---

<div class="post-metadata">

**Author:** ![puneeth](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e68b1a/32.png) [@puneeth](https://www.ruby-forum.com/u/puneeth)\
**Post date:** [July 23, 2015, 12:24pm UTC](https://www.ruby-forum.com/t/proxy-pass-redirection/242730/3 "2015-07-23T12:24:39Z")

</div>

Thank for the quick response.

My proxy\_pass path will keep on changing as per my topic, so I want to  
keep to dynamic. Pls check below e.g.

proxy\_pass [http://IP:8881/ingestion/v1.0/streams/NGINEX](http://IP:8881/ingestion/v1.0/streams/NGINEX);  
or  
proxy\_pass [http://IP:8881/ingestion/v1.0/streams/NGINEX1](http://IP:8881/ingestion/v1.0/streams/NGINEX1);  
or  
proxy\_pass [http://IP:8881/ingestion/v1.0/streams/NGINEX2](http://IP:8881/ingestion/v1.0/streams/NGINEX2);

So that last word I want to keep it has dynamic, please help.

---

<div class="post-metadata">

**Author:** ![puneeth](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e68b1a/32.png) [@puneeth](https://www.ruby-forum.com/u/puneeth)\
**Post date:** [July 23, 2015, 2:15pm UTC](https://www.ruby-forum.com/t/proxy-pass-redirection/242730/4 "2015-07-23T14:15:30Z")

</div>

On Wed, Jul 22, 2015 at 11:26:11AM +0200, Puneeth Kumar wrote:

Hi there,

> I’m able to configured Nginx and it’s working but I’ve challenge in  
> configuring it for Dynamic proxy\_pass. I’ve tried to use wild characters  
> in proxy\_pass it’s not working, please help.

The proxy\_pass documentation is at [Module ngx\_http\_proxy\_module](http://nginx.org/r/proxy_pass).

I am not sure what you mean by “dynamic”.

You want to make one http request of nginx; and you want nginx to make  
one http request of the proxy\_pass upstream server.

Can you give some examples of the request you make to nginx, and the  
request that you want nginx to make of upstream?

That might make clearer what it is you want to do.

Note that if you use

location /one/ {  
proxy\_pass [http://upstream/two/](http://upstream/two/);  
}

then if you make a request of /one/abc, nginx will make a request of  
/two/abc to upstream; and if you make a request of /one/def, nginx will  
make a request of /two/def to upstream.

Is that what you mean by “dynamic”? If so, things should Just Work. If  
you mean something else, please explain.

## f

Francis D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![puneeth](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e68b1a/32.png) [@puneeth](https://www.ruby-forum.com/u/puneeth)\
**Post date:** [July 24, 2015, 11:16am UTC](https://www.ruby-forum.com/t/proxy-pass-redirection/242730/5 "2015-07-24T11:16:12Z")

</div>

Thank you Francis for the links & the solution.

Sorry for confusion, proxy\_pass is working for me.

I’m passing below link (exact URI) to proxy\_pass

[http://IP:8881/ingestion/v1.0/streams/NGINEX](http://IP:8881/ingestion/v1.0/streams/NGINEX).

I want to keep the link(URI) only till  
[http://IP:8881/ingestion/v1.0/streams/](http://IP:8881/ingestion/v1.0/streams/)  
& the last word (NGINX) application should pick.  
So Can I pass \* type of wild char to the link? please help.

[http://IP:8881/ingestion/v1.0/streams/](http://IP:8881/ingestion/v1.0/streams/)\*

Thank you

---

<div class="post-metadata">

**Author:** ![puneeth](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e68b1a/32.png) [@puneeth](https://www.ruby-forum.com/u/puneeth)\
**Post date:** [July 25, 2015, 12:45am UTC](https://www.ruby-forum.com/t/proxy-pass-redirection/242730/6 "2015-07-25T00:45:38Z")

</div>

On Fri, Jul 24, 2015 at 11:16:12AM +0200, Puneeth Kumar wrote:

Hi there,

> Sorry for confusion, proxy\_pass is working for me.
> 
> I’m passing below link (exact URI) to proxy\_pass
> 
> [http://IP:8881/ingestion/v1.0/streams/NGINEX](http://IP:8881/ingestion/v1.0/streams/NGINEX).
> 
> I want to keep the link(URI) only till  
> [http://IP:8881/ingestion/v1.0/streams/](http://IP:8881/ingestion/v1.0/streams/)  
> & the last word (NGINX) application should pick.

I do not understand what you want.

Can you write down one request that you will make to nginx, and the  
matching request that you want nginx to make to its upstream?

And then, write down one other request that you will make to nginx,  
and the matching request that you want nginx to make to its upstream.

That may make it clear what proxy\_pass directive you want.

## f

Francis D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
