Deploy Flask socketio on Linode

Hello Linode community.
I developed a flask web application on my local host. The application includes chatroom functionality which I implemented using flask-socketio. The application works fine on localhost. Last week I deployed my flask application on Linode and socket functionality is not working.
Here are the configuration diff between my localhost and Linode:

  1. In Linode, I don't use the following command ",host="",allow_unsafe_werkzeug=True,debug=True, use_reloader=False)". Instead, I added "import run" to file. (the command is in the __main of

  2. I configure nginx file as follow:
    *server {
    listen 80;

    location / {
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

    location / {
    include proxy_params;
    proxy_http_version 1.1;
    proxy_buffering off;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "Upgrade";

When I load the application I don't get errors on the server side. But on my client I get 502 bad gateway.
Request URL: Request Method: GET Status Code: 502 Bad Gateway Remote Address: Referrer Policy: strict-origin-when-cross-origin

Any idea how to fix this?


1 Reply

I managed to fix the problem.
As per flask-socketio documentation,

I default back to standard nginx configuration (remove section).

I'm running my application using:
"gunicorn -k gevent -w 1 <my module="">:app"</my>


Please enter an answer

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct