1

I am trying to run Tornado on multicore CPU with each tornado IOLoop process on a different core, and I'll use NGINX for proxy pass to Tornado processes. Now when I check http://www.tornadoweb.org/en/stable/guide/running.html

Editing the actual configuration here for more details:

events {
worker_connections  1024;
}

http {
upstream chatserver {
    server 127.0.0.1:8888;
  }

server {
    # Requires root access.
    listen       80;

    # WebSocket.
    location /chatsocket {
        proxy_pass http://chatserver;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }

    location / {
        proxy_pass http://chatserver;
    }
  }
}

Now previously I was able to connect to socket ws://localhost:8888 from client (When I was running python main.py but now I can't connect. At the server, NGINX is changing the request to http somehow that I want to avoid. Access logs at tornado server:

WARNING:tornado.access:400 GET /search_image (127.0.0.1) 0.83ms

How can I make the nginx only communicate via ws:// not http://

Ishan Sharma
  • 115
  • 2
  • 9
  • Possible duplicate of [Nginx configuration for the Tornado websocket demo?](http://stackoverflow.com/questions/22367215/nginx-configuration-for-the-tornado-websocket-demo) – kwarunek Apr 01 '16 at 19:14
  • No, I don't think it is. I want to use ws://.... at client side as well. And I am not able to solve it using the configuration mentioned in the above link. – Ishan Sharma Apr 02 '16 at 07:39
  • I figured out the issue and it was solved by overriding tornado's check_origin function by making it return true in all cases. Thank you all. – Ishan Sharma Apr 02 '16 at 09:23

1 Answers1

0

I figured out the issue and it was solved by override tornado's check_origin function by making it return true in all cases. Thank you all.

Ishan Sharma
  • 115
  • 2
  • 9