Categories
Mastering Development System & Network

Nginx Reverse Proxy Woes

I have an install of NGINX on Ubuntu LTS 18.04. I am trying to set up the following using a reverse proxy:

site.example.com/ -> 10.0.1.35:8088/slweb
site.example.com/slserver -> 10.0.1.35:8089/slserver

I am able to get the second rule to work without issue, however the first one always seems to redirect me to my alphabetically first sites-enabled site.

Here’s my configuration:

server {
server_name site.example.com;

location / {
proxy_pass_header Authorization;
proxy_pass http://10.0.1.35:8088/slweb;
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_http_version 1.1;
proxy_set_header Connection “”;
proxy_buffering off;
client_max_body_size 0;
proxy_read_timeout 36000s;
proxy_redirect off;
}

location /slserver {
proxy_pass_header Authorization;
proxy_pass http://10.0.1.35:8089/slserver;
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_http_version 1.1;
proxy_set_header Connection “”;
proxy_buffering off;
client_max_body_size 0;
proxy_read_timeout 36000s;
proxy_redirect off;
}
listen 80;
}

Thank you for your help!
Marton

ps if I change the location to /slweb, and remove that from the proxy pass, it works fine, I simply want this to be on the root of the subdomain.

Leave a Reply

Your email address will not be published. Required fields are marked *