xbapps / xbvr

Tool to organize and stream your VR porn library
345 stars 129 forks source link

XBVR behind NGINX Proxy #624

Open NodudeWasTaken opened 2 years ago

NodudeWasTaken commented 2 years ago

Hello!

I seem to be unable to use XBVR behind a proxy using this config

location /xbvr/ {
    proxy_pass http://127.0.0.1:9999/;
    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_read_timeout 90;
}

It results in XBVR ignoring the specified subdomain and redirecting to /ui/ on the root domain. I suspect its because it doesn't support the forwarded standard. I could partially get around this by checking the refered header and redirecting back, but this did not work for the websocket.

Any chance for support for this?

Thanks

slabking commented 2 years ago

Here's the full reverse proxy config I'm using with swag:

server {
    listen 443 ssl;
    listen [::]:443 ssl;

    server_name xbvr.*;

    include /config/nginx/ssl.conf;

    client_max_body_size 0;

    # enable for Authelia
    include /config/nginx/authelia-server.conf;

    location / {

        # enable for Authelia
        include /config/nginx/authelia-location.conf;

        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
        include /config/nginx/proxy.conf;
        include /config/nginx/resolver.conf;
        set $upstream_app xbvr;
        set $upstream_port 9999;
        set $upstream_proto http;
        proxy_pass $upstream_proto://$upstream_app:$upstream_port;

    }

}

Note that I'm enabling Authelia, for authentication and 2FA. You can comment that out if you want, but you should implement some other form of authentication if you're opening this outside of your network.

EDIT: I see now. You're trying to run XBVR from a subfolder, not a subdomain. The config I posted might not work for you, then.

eanzie commented 2 years ago

Please allow for configuring all returned urls to have addition of path prefix "/xbvr" and with"https" when returning full urls for when behind reverse proxies. Either a config or you could honor X-Forwarded-Proto to know what the original requestor used.

dan9qt commented 1 year ago

I am able to view the webui using the nginx config posted by @slabking , but using heresphere the video cards don't load properly and nothing is available to play, and using deovr the cards load at least but still nothing plays. Bandwidth is definitely not an issue so does anyone have any idea what the issue could be? Is there some sort of special setup to get heresphere going (my prefered player)

slabking commented 1 year ago

For Heresphere, I ended up opening ports to the Docker container (but only on my LAN). I found the reverse proxy added too much lag to be usable for VR. So, I use the reverse proxy for accessing XBVR on the computer, and the IP/ports in Heresphere.

dan9qt commented 1 year ago

I'm looking to use this remotely so not wanting to use IP and ports (although if I could get tailscale to work on a quest that would be perfect). I have definitely had this working before pre-heresphere, but there must be some magic to getting heresphere to work.

slabking commented 1 year ago

Interesting. For security, are you using Authelia, or HTTP basic authentication? XBVR doesn't support its own authentication, does it?

eanzie commented 1 year ago

Yes, I ended up putting the container in my remote Kubernetes cluster with nginx ingress with its own subdomain, letsencrypt and basic auth.