Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
lan10rd opened this issue Mar 26, 2021 · 3 comments

Comments

@lan10rd
Copy link

lan10rd commented Mar 26, 2021

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
Copy link

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
Copy link

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
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants