Welcome! Log In Create A New Profile

Advanced

Using nginx as reverse_proxy with subfolders

Posted by Judge 
Using nginx as reverse_proxy with subfolders
May 18, 2016 02:19AM
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!



Edited 1 time(s). Last edit at 05/18/2016 02:20AM by Judge.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 125
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready