Skip to content

Cross Origin Requests for Polling Transport Results in a Bad Request #2547

@brodeuralexis

Description

@brodeuralexis

EDIT: Just in case someone was wondering, but when launching the Socket.IO server in local, everything works as expected.

I have been trying to get a Socket.IO server working through a nginx proxy in order make a small chat application for a school assignment, however, the client makes a lot of XHR ending with a 400

network-requests

Though it seems like Engine.IO is processing them

console-debug

My client is running in local and here is where I create the connection, and the code for the server side is available here and deployed at chat-socket-io.brodeuralexis.com.

Here is my nginx configuration:

upstream backend {
    server 127.0.0.1:3000;
}

server {
    listen 80;

    access_log /var/log/nginx/chat-socket-io.access.log;
    error_log /var/log/nginx/chat-socket-io.error.log;

    server_name chat-socket-io.brodeuralexis.com;

    large_client_header_buffers 8 32k;

    location / {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_set_header X-NginX-Proxy true;

        proxy_buffers 8 32k;
        proxy_buffer_size 64k;

        proxy_pass http://backend;
        proxy_redirect off;

        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions