LizardByte / Sunshine

Self-hosted game stream host for Moonlight.
http://app.lizardbyte.dev/Sunshine/
GNU General Public License v3.0
17.89k stars 865 forks source link

WebUI can't be used as subpath behind Nginx reverse proxy #3008

Open Degot opened 1 month ago

Degot commented 1 month ago

Is there an existing issue for this?

Is your issue described in the documentation?

Is your issue present in the latest beta/pre-release?

This issue is present in the latest pre-release

Describe the Bug

When Sunshine is used behind NGINX location it is not working properly because of wrong HREFs/URLs

location /sunshine/ {
    auth_request /authelia;
    set $target_url $scheme://$http_host$request_uri;
    auth_request_set $user $upstream_http_remote_user;
    auth_request_set $groups $upstream_http_remote_groups;
    auth_request_set $name $upstream_http_remote_name;
    auth_request_set $email $upstream_http_remote_email;

    proxy_set_header Remote-User $user;
    proxy_set_header Remote-Groups $groups;
    proxy_set_header Remote-Name $name;
    proxy_set_header Remote-Email $email;
    error_page 401 =302 https://auth.xxxxxx.xx/?rd=$target_url;

    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "Upgrade";
    proxy_set_header Host $host;
    proxy_buffering off;
    proxy_pass https://10.10.10.10:47990/;
}

Expected Behavior

No response

Additional Context

Issue is can be fixed by modifying all HTML, CSS, JS by changing /assets to ./assets... same for all other paths

Host Operating System

Windows

Operating System Version

Windows 10

Architecture

64 bit

Sunshine commit or version

v2024.808.173930

Package

Windows - portable

GPU Type

Nvidia

GPU Model

RTX 2080

GPU Driver/Mesa Version

32.0.15.6070

Capture Method

None

Config

wan_encryption_mode = 0
origin_web_ui_allowed = wan
nvenc_preset = 3
nvenc_spatial_aq = enabled
external_ip = 10.10.10.10

Apps

No response

Relevant log output

[2024-08-12 14:12:03.798]: Info: Sunshine version: v2024.808.173930
ReenigneArcher commented 1 month ago

https://github.com/LizardByte/Sunshine/pull/2343

There was this PR, but the author closed it.

Nonary commented 1 month ago

You're right that we could make some changes to make it easier for reverse proxies, but you could also use a combinations of sub filters and URL Rewrites to fix the issue on the reverse proxy side as well.