A
A
Abdul Amenov2021-02-11 06:46:26
JavaScript
Abdul Amenov, 2021-02-11 06:46:26

Socket.io code 3 Bad request, how to fix?

Hello!

Now I am packaging my application on Nuxt.js in Docker + Nginx.

And I ran into a problem that was not there during development.

When I connect to socket.io it says code 3, message Bad request.

Please tell me what am I doing wrong?

Nginx config:

server {
    listen 80;
    listen [::]:80;

    server_name enterprise.logist.plus.loc;

    underscores_in_headers on;

    location / {
        proxy_pass http://frontend_enterprise:3000;
    }

    location /socket.io/ {
        proxy_http_version 1.1;

        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';

        proxy_pass http://api_enterprise:5000/socket.io/;
    }

    location /api {
        rewrite /api/(.*) /$1 break;
        rewrite /api(.*) /$1 break;

        proxy_pass http://api_enterprise:5000;
    }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2021-02-11
@q2digger

did you put everything in one container? Or are they two different ones? if the message you are writing about refers to your application (and judging by the text, this is not an nginx error), then it is the container with the application that needs to be debugged (what is in the logs? can you add some debugging?).
and to be honest, it's hard to say something definite without seeing the Dockerfile and docker-compose.yml , but guessing here is a so-so job.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question