Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

394
Visualizações
How does one set up an Nginx server to use WebSockets?

I have a website that needs to work through an Nginx server. At the moment, I don't believe the configuration for nginx is correct. I currently have

server{
        server_name websitename.com;

       location /websocket/{
                proxy_pass http://websitename.com;
                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection "Upgrade";
                proxy_set_header $host;
        }

}

At the moment, I am receiving an error on the website that reads "SCRIPT12008: SCRIPT12008: WebSocket Error: Incorrect HTTP response. Status code 200, OK", which I believe is because the protocol is not switching correctly.

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

You forgot the double quotes and "Host" before $host to set the Host directive:

 proxy_set_header "Host" $host;

So your setup would like this instead:

 server{ server_name websitename.com; location /websocket/{ proxy_pass "http://websitename.com"; proxy_http_version 1.1; proxy_set_header "Upgrad"e $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host $host; } }

Always check your syntax with the 'nginx -t' command.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda