0

I have several web apps I like to proxy with a single URL. This is my nginx.conf

server {
    listen 443 ssl;

    server_name webapps.mysite.com 192.168.5.28;

    access_log  /var/log/nginx/webapps_access.log;
    error_log   /var/log/nginx/webapps_errors.log;

    ssl_certificate /etc/letsencrypt/live/webapps.mysite.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/webapps.mysite.com/privkey.pem; # managed by Certbot


    location /casaos {
        proxy_pass http://192.168.5.165:81;
        proxy_intercept_errors on;
        proxy_buffering off;
        proxy_http_version 1.1;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $http_connection;
        # access_log off;

    }

    location /guacamole/ {
        proxy_pass http://192.168.5.44:8080;
        proxy_intercept_errors on;
        proxy_buffering off;
        proxy_http_version 1.1;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $http_connection;
        # access_log off;
    }

    location /apps {
        # The following configurations must be configured when proxying to Kasm Workspaces

        # WebSocket Support
        proxy_set_header        Upgrade $http_upgrade;
        proxy_set_header        Connection "upgrade";

        # Host and X headers
        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;

        # Connectivity Options
        proxy_http_version      1.1;
        proxy_read_timeout      1800s;
        proxy_send_timeout      1800s;
        proxy_connect_timeout   1800s;
        proxy_buffering         off;
        proxy_intercept_errors on;

        # Allow large requests to support file uploads to sessions
        client_max_body_size 10M;

        # Proxy to Kasm Workspaces running locally on 8443 using ssl
        proxy_pass https://192.168.5.40;
    }
}

If I use the ip's of the webapps they work;

HTTP://192.168.5.165:81

HTTP://192.168.4.44:8080

HTTP://192.168.5.40

but in my site config, only site that works is the guacamole app works.

HTTP://webapps.mysite.com/guacamole/

The other gives me a 404.

HTTP://webapps.mysite.com/apps

HTTP://webapps.mysite.com/casaos

How can I troubleshoot why I am getting 404? The logs are giving me nothing either, I only my tries accessing my site

One more thing, if I only proxy only one web as a /, they work.

location / {
    proxy_pass http://192.168.5.165:81;
    proxy_intercept_errors on;
    proxy_buffering off;
    proxy_http_version 1.1;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $http_connection;
    # access_log off;

}

So this again is bugging me that I can host multi-web apps.

Tero Kilkanen
  • 36,796
  • 3
  • 41
  • 63
terrorpup
  • 1
  • 1
  • Try adding a trailing `/` to the end of the `location` and `proxy_path` directives. For example: `location /casaos/ { proxy_pass http://192.168.5.165:81/; ... }` – Richard Smith Oct 22 '22 at 18:47
  • I've tried that as well, still getting the 404 error. Thanks. It's why I asked if there's way to troubleshoot the proxy. Would setting the logs to debug help? – terrorpup Oct 22 '22 at 20:06
  • Ok, I am getting close. I went ahead and made Kasm Web proxy on /, as I stated earlier that works. I am fine with that. CasaOS started to return a white page, now my issue appears to be javascript – terrorpup Oct 22 '22 at 22:29
  • You need to look at the upstream application logs to see which URL is actually requested. – Tero Kilkanen Oct 23 '22 at 12:56

0 Answers0