Is it possible to forward http://example.com
to http://example.com:5000/foo
?
I tried using proxy_pass to forward requests to port 5000:
location / {
proxy_pass http://127.0.0.1:5000/;
}
Which works as expected. However, if I want to forward requests to /foo
, I can't just change the proxy_pass to proxy_pass http://127.0.0.1:5000/foo/
since it wouldn't be able to find the static files.
So I then tried to use try_files
in hopes to serve the static files correctly:
location / {
try_files $uri /foo/;
}
location /foo/ {
proxy_pass http://127.0.0.1:5000/;
}
But that wouldn't work either since the resources are under port 5000. Any help?