Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

Dynamic Proxy_pass based on subdirectory

$
0
0
hello people

been slamming my head off a wall for some time with this config... i have more of an apache background but persevering with NGINX for this project!

basically, I have created a simple reverse proxy to serve http sites as https, and it works very well using the following config

location /subdirectory/ {
sub_filter '=/"' '="'; #remove /
sub_filter_once off;
proxy_pass http://subdirectory.domain.com/;
}

what i was hoping to do was expand this with regex

location ~* ^/(.*)/$ {
sub_filter '=/"' '="'; #remove /
sub_filter_once off;
proxy_pass http://$1.domain.com/;
}

but this returns 502 bad gateway.

have tried various configs, and cannot get this to resolve properly at all...

fingers crossed for some insight :)

Viewing all articles
Browse latest Browse all 4759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>