2

I currently have nginx serving as a reverse proxy on my router with a single server block and multiple locations mapping to specific ports on my NAS. Everything seems to be working fine except for one item -- Synology DSM. Right now, the only way that I have WAN access to DSM in my setup is with the following configuration:

location / {
   proxy_pass http://127.0.0.1:5000;
}

I'd prefer to have something like this:

location /dsm {
   proxy_pass http://127.0.0.1:5000;
}

However, I can't seem to get this to work. I've tried location and proxy_pass with/without ending slashes and attempted different rewrite options but nothing has worked. I either get "page not found" errors or the page loads and I can view the source but nothing is displayed.

It should be noted that the DSM is CGI-based (loads as http://127.0.0.1:5000/webman/index.cgi) and it looks like there are absolute paths hardcoded in the css and js.

shrimpy
  • 21
  • 1
  • 4

1 Answers1

0

Asked 3 years ago, but I had this month (Oct 2018) the same problem. Yes, it is a mess with hard-coded paths. Simple PassProxy/ProxyPassReverse is not working. I am no computer expert, not at all. I found this configuration somewhere on internet, among many, many other propositions, and as a miracle it was the only one that worked ... (Debian 9, Apache2). Slashes must be exactly in this way. You must call dsm as http://your.local.server.name/dsm/ or http://your.internet.name/dsm/. I hardly know what exactly every configuration line does, and I don't dare delete anything. Let the gurus figure out ...

On my machine, I edited /etc/apache2/sites-enabled/000-default.conf but I suppose the script would work on any reverse-proxy server.

<VirtualHost *:80>
ServerName your.local.server.name
ServerAlias your.internet.name

<Location /dsm/>
ProxyPass http://your.synology.dsm:5000/
ProxyPassReverse /
ProxyHTMLEnable On
ProxyHTMLURLMap /       /dsm/
RequestHeader unset  Accept-Encoding

Order allow,deny
Allow from all

</Location>
</VirtualHost>