fcwu / docker-ubuntu-vnc-desktop

A Docker image to provide web VNC interface to access Ubuntu LXDE/LxQT desktop environment.
Apache License 2.0
3.97k stars 1.44k forks source link

Behind a gateway nginx proxy, Error during WebSocket handshake: Unexpected response code: 404 #231

Open lan10rd opened 3 years ago

lan10rd commented 3 years ago

I am trying to deploy this behind a reverse proxy (nginx), and i have other examples of my apis using socket.io that work when upgraded to wss, but for some reason i am seeing:

Error during WebSocket handshake: Unexpected response code: 404

on the webshockify call.

I am forcing all http traffic to be upgraded to https and i see everything working except for this wss://mydomain/webshockify call, here is my configuration so far:

server { client_body_timeout 10m; client_header_timeout 10m; client_max_body_size 1000000M; large_client_header_buffers 8 32k; listen 443 ssl http2; listen [::]:443 ssl http2; send_timeout 10m; server_name face.ocelot.work; ssl_certificate /etc/letsencrypt/live/XX/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/XX/privkey.pem; fastcgi_buffer_size 256k; fastcgi_buffers 8 128k; fastcgi_read_timeout 300s; add_header X-Frame-Options ""; proxy_buffer_size 128k; proxy_buffers 4 256k; proxy_busy_buffers_size 256k;

proxy_set_header Proxy ""; # to mitigate httpoxy attack

location /webshockify/ {
    proxy_pass $upstream;
    set $upstream http://XX_container:80;

    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "Upgrade";
    proxy_set_header Host $host;

    # enable sticky session based on IP
    # ip_hash;

    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Real-IP $remote_addr;
}
location / {
    proxy_buffer_size 128k;
    proxy_buffers 4 256k;
    proxy_busy_buffers_size 256k;
    proxy_pass $upstream;
    proxy_set_header   Host $host;
    set $upstream http://XX_container:80;
    proxy_ssl_server_name on;
}
falcorocks commented 2 years ago

I am too trying to deploy this image behind a reverse proxy (traefik) and I too get the same 404 error. @lan10rd it's been a long while and you had no replies, have you perhaps found a workaround?

lakemike commented 2 years ago

I'm running this container successfully behind traefik / authelia (2FA). Please see these two files "docker-compose.yml" and launch script "up.sh" docker-compose.yml.txt up.sh.txt

falcorocks commented 2 years ago

I'm running this container successfully behind traefik / authelia (2FA). Please see these two files "docker-compose.yml" and launch script "up.sh" docker-compose.yml.txt up.sh.txt

Thanks! I don't see anything special about your compose file or your traefik labels. It the magic sauce in the up.sh?