title: Nginx, flask-socketio - blocked by CORS policy
body: <p>I have a flask-socketio server running on ubuntu with nginx. I have a client calling the server. When I try  to call the server I receive the following error:</p>
  <pre><code>has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header contains multiple values '*, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *, *', but only one is allowed.
  </code></pre>
  <p>This is my initialization with flask:</p>
  <pre><code>socketio = SocketIO(app, cors_allowed_origins='*', async_mode='eventlet')
  </code></pre>
  <p>...</p>
  <pre><code>if __name__ == '__main__':
      socketio.run(app, host=&quot;0.0.0.0&quot;, port='80', debug=False)
  </code></pre>
  <p>This is my current config in nginx:</p>
  <pre><code>server {
      listen 80;
      server_name server-address;
  
      location / {
      include proxy_params;
      proxy_pass http://server-address;
      include uwsgi_params;
      uwsgi_pass unix:/home/user/project/project.sock;
      }
  
      location /socket.io{
      include proxy_params;
      add_header &quot;Access-Control-Allow-Origin&quot; &quot;*&quot; always;
      proxy_http_version 1.1;
      proxy_buffering off;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection &quot;Upgrade&quot;;
      proxy_pass http://server-address/socket.io;
      }
  }
  </code></pre>
  <p>And the request to the server from the client looks like this:</p>
  <pre><code>http://server-address/socket.io/?EIO=3&amp;transport=polling&amp;t=1617406124248-38
  </code></pre>
  <p>I have tried:</p>
  <p>-Adding the allow CORS to location / only, and both.
  -Removing/adding allow CORS origin in the flask app.</p>
  <p>Can anyone help?</p>