0

I am running an unsecured ScreenConnect web interface on a machine on my local network. I would like to serve it through port 443 using nginx's reverse proxy, and access it via:
https://<WAN.IP.ADDRESS>/screenconnect

My nginx.conf location block:

            location / {
            root /www/var/nginx/html
            }

            location /screenconnect/ {
            proxy_pass                              http://local.screenconnect.server:8040/;
            proxy_buffering                         off;
            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;
            }

I am successful in getting to the Screen Connect Web Interface, and the url reads as
https://<WAN.IP.ADDRESS>/screenconnect/

However, any additional subdirectories that I access, such as https://<WAN.IP.ADDRESS>/screenconnect/login.php? will drop the /screenconnect/ subdirectory and try to access https://<WAN.IP.ADDRESS>/login.php?
This throws me a 404 error.

Things I've tried

  • I've inserted /screenconnect/ to https://<WAN.IP.ADDRESS>/login.php?/ and got https://<WAN.IP.ADDRESS>/screenconnect/login.php?, which gives me the site I need.
  • I've adjusted the web.config file on my screenconnect server and appended the correct directory:
    <add key="WebServerAddressableUri" value="https://WAN.IP.ADDRESS:443/screenconnect/" />
  • I've tried removing the / at the end of proxy_pass http://local.screenconnect.server:8040/; and location /screenconnect/
  • I've also tried a host of different simple directives for the location block from people who have had related problems
  • I've replaced the IP of the screenconnect server with an apache server running on port 80 that has a simple html page, which redirects to a subfolder. When redirecting, the /screenconnect/ directory is prepended correctly.
2
  • I believe that the application is doing this behavior due a miss or wrong configuration. I'm unfamiliar with rewrite of nginx but it might have a chance
    – djdomi
    Jun 2, 2022 at 2:18
  • Generally it is the ScreenConnect (or any upstream web app) job, to generate its links including the correct URI prefix. The only available info about this subject I found so far is about the WebServerAddressableUri parameter which you already tried to adjust with no luck; unfortunally looks like the support forums are dead now. You can check the How to handle relative urls correctly with a nginx reverse proxy ServerFault thread. Jun 2, 2022 at 13:40

0

You must log in to answer this question.

Browse other questions tagged .