jlesage / docker-handbrake

Docker container for HandBrake
MIT License
808 stars 92 forks source link

noVNC behind reverse proxy #258

Open shlomitan opened 1 year ago

shlomitan commented 1 year ago

Hi, I'm trying to use handbrake behind a swag reverse proxy. I'm using linuxserver/swag with their sample format for routing the url. The first problem is that I got a 404 error from nginx. Looking at access.log and error.log I figured out that the container was looking for files at /opt/noVNC/handbrake/ instead of /opt/noVNC/. I worked around this by making that directory and then moving everything from noVNC inside.

Now I get nice screen with a red bar on top that says "Failed to connect". There is no new errors at error.log but access.log has a bunch of stuff.

Could this still be about my routing? I'm not sure who can help me, but I would really appreciate any help :) My proxy config: `location /handbrake { return 301 $scheme://$host/handbrake/; }

location ^~ /handbrake/ {

include /config/nginx/proxy.conf;
include /config/nginx/resolver.conf;
set $upstream_app handbrake;
set $upstream_port 5800;
set $upstream_proto http;
proxy_pass $upstream_proto://$upstream_app:$upstream_port;

location /handbrake/websockify {
    proxy_pass $upstream_proto://$upstream_app/websockify/;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $connection_upgrade;
    proxy_read_timeout 86400;
    }

} `

Is there any other checks I can do? I'm really new to all of this but I can google whatever you throw at me :) Thanks!!

johnvick commented 1 year ago

This works for me: server { listen 443 ssl; listen [::]:443 ssl;

server_name handbrake.*;
add_header X-Robots-Tag "noindex, nofollow, nosnippet, noarchive";

include /config/nginx/ssl.conf;

client_max_body_size 0;

# enable for ldap auth, fill in ldap details in ldap.conf
#include /config/nginx/ldap.conf;

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

location / {
    # enable the next two lines for http auth
    auth_basic "Restricted";
    auth_basic_user_file /config/nginx/.htpasswd;

    # enable the next two lines for ldap auth
    #auth_request /auth;
    #error_page 401 =200 /ldaplogin;

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

    include /config/nginx/proxy.conf;
    include /config/nginx/resolver.conf;
    set $upstream_app 192.168.1.59;
    set $upstream_port 5800;
    set $upstream_proto http;
    proxy_pass $upstream_proto://$upstream_app:$upstream_port;

Only slightly modified from default. I have used 192.168.1.59 as SWAG and Handbrake are on different servers. And I use subdomain not subfolder. `

shlomitan commented 1 year ago

@johnvick I can only use subfolders, not subdomains.. Why did you put the ip as $streamapp and not the handbrake container name?

johnvick commented 1 year ago

This is default setting. Most Docker/SWAG setups work better with subdomains than subfolders in my experience. As I said I made minimal changes to the default nginx profile, just IP address and authentication.

jlesage commented 1 year ago

You may want to check the example in documentation: https://github.com/jlesage/docker-handbrake#routing-based-on-url-path

Note that the presence or not of the ending / in path is very important.

johnvick commented 1 year ago

I maybe should have made it clearer - I use the SWAG Nginx proxy-conf and it work fine with minor modifications for my setup.

shlomitan commented 1 year ago

OK, I almost got it! I added the / in my proxy pass so now it's proxy_pass $upstream_proto://$upstream_app:$upstream_port/; This solved the problem of looking for the files in the wrong place. I removed the container and image to clear up the mess I made inside. Now my problem is that there is no graphics on the page, just some text, textboxes, and broken pictures. Looking at the network tab of Firefox developer tools showed that for ui.js I get an error NS_ERROR_CORRUPTED_CONTENT. Any idea what to do with that?

Thanks!