0

I have read this post, and try many thing but i have issue with rewrite regex. here

I have many node.js processes as backends with always different port to access.

With Nginx reverse proxy in the same server i want to pass for exemple : https://my-site/1881 to http://127.0.0.1:1881 proxy_pass.

I can get 1881 from my-site/1881 but i have always at the end 127.0.0.1:1881/1881. Or Nginx error. I don't knows exactly how to delete /1881 with rewrite.

That i tried :

location ~ ^/(?<port>\d\d\d\d)$ {            #Ok

        rewrite "^/[0-9]{4}(.*)$" $1 break;  #try and retry here
        proxy_pass http://127.0.0.1:$port;   #Ok
}

Thank you for your help, have a good day

1 Answers1

0

Ok,

I'm running with :

location ~ ^/(?<port>\d\d\d\d) {

rewrite "^/\d{4}/(.*)" /$1 break;
proxy_pass http://127.0.0.1:$port;

}

And working well but now not displaying any picture :-(