Nginx, proxy_pass, mangled relative links upstream

nginxsupervisord

I'm having a problem with nginx proxy_pass and have pored over the HttpProxyModule documentation at the nginx wiki, but can't figure it out.

I have Supervisor (http://supervisord.org/) running on a localhost (127.0.0.1:9001) and nginx redirecting all traffic from port 80 to 443. I'd like to be able to get to the supervisor status page when I go to https://mydomain/supervisor.

The relevant parts of my nginx.conf file looks like this –

server {
  listen 80;
  server_name mydomain;
  return 301 https://$host$request_uri;
} 

server {
 listen 443;
 server_name mydomain;
 # .. bunch of ssl stuff

 location /supervisor/ {
    proxy_set_header Host $host;
    proxy_pass http://127.0.0.1:9001/;
    }
}

That works great, when I go to https://mydomain/supervisor, I get the supervisord status webpage. But when I hit the 'refresh' link (on the page, not the browser refresh) or start/stop a process, then I'm getting sent back to a page like http://mydomain/?message=Process app started, which just takes me to an nginx splash screen instead of the supervisor page. I've double checked the html source on the page, and it's giving me relative links. So it seems to be something in my config that is stripping out the /supervisor/, I'm just not sure what.

Thanks,

Best Answer

Looks like supervisor doesn't work well when run in subpath.

Setup Nginx with supervisor accessible on subdomain, for example: http://supervisor.yourdomain.com/