Proxy_pass redirection

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;
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; (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

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

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;
or
proxy_pass http://IP:8881/ingestion/v1.0/streams/NGINEX1;
or
proxy_pass http://IP:8881/ingestion/v1.0/streams/NGINEX2;

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

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.

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/;
}

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. [email protected]

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.

I want to keep the link(URI) only till
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/*

Thank you

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.

I want to keep the link(URI) only till
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. [email protected]