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

Using nginx as reverse_proxy with subfolders

$
0
0
Hello everyone,

I have several applications, which are running on dedicated servers. For some of them, I cannot change the subfolder, so they are available with their domain (like http://application1 ).
I want these distributed services to be available as subfolders of a single domain; for example:

(nginx reverse_proxy)
https://my-domain/app1/ <---------> http://application1

Basically, this works, but I'm struggling with the fact, that the subfolder-part gets send to the application server, too; thus, a request like http://application1/app1/ is done and I either get an 404 or "302 Too many redirects" from the application servers.

(How) can I make this work the way that users can use the https://my-domain/app1/ URI without being redirected, but nginx doing it's requests to the application servers without the subfolder part?

My current configs look like this:

location ~ /piwik(/|$) {
proxy_pass http://piwik-mynick.rhcloud.com;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;

proxy_connect_timeout 300;
proxy_send_timeout 300;
proxy_read_timeout 300;
}

Thank you for your help!

Viewing all articles
Browse latest Browse all 4759

Trending Articles



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