Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

393
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!