Hello,
Currently I have a website sitting at "site1.domain.com" which I would like to proxy pass to another host like "domain.com/site1/" reason for this is I have multiple sites on separate systems and want to keep them all appended this way.
My problem however is when loading "domain.com/site1/" it spins as it's trying to load other directories which are loading from site1.domain.com without the appended /site1/.
I realize Nginx only proxies specific requests yet is there a way to have this work and proxy everything from "site1.domain.com" to include subdirectories and files to "domain.com/site1/".
My config is...
location /site1/ {
proxy_set_header Host $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_pass http://site1.domain.com/;
proxy_read_timeout 90;
proxy_redirect http://site1.domain.com/ https://domain.com;
}
I've tried using "rewrite /site1/([^/]+) /$1 break;" after location but nothing seems to be working.
Ideally I've done this by adding each location its specifying and then using a rewrite but I'd rather have it all in 1 rule as I have multiple other sites I plan to add to this.
Any help would be appreciated!