Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

Websocket connection with proxy pass Nginx 1.3.13 or greater

$
0
0
I have been stuck on an issue for about a week and was curious if anyone had any thoughts for me to peruse.

I have found many stack overflow questions and websites about this issue but none seem to work for me.

if you go to http://troyblank.no-ip.biz/ferd-o-vision/ and click on 'connect to socketio' you get a 400 error that clearly does not have 'socketio' in the headers of the request like it should (this does work locally using django runserver btw). What I think have figured out is nginx is not set to do web-sockets.

As you see from the request I am using Nginx 1.3.16, which should allow such a connection and here is my website config

server {
listen 80;
server_name troyblank.no-ip.biz;
root /home/troy/webapps/raspberry_pi;

access_log /home/troy/webapps/raspberry_pi/log/access.log;
error_log /home/troy/webapps/raspberry_pi/log/error.log;

location / {
proxy_pass http://troyblank.no-ip.biz:8080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
}

location /static/ {
alias /home/troy/webapps/raspberry_pi/static/;
}

}

I am running raspian (debian) with Apache as my proxy to the backend that is running the Django framework that uses gevent to connect to the websocket... but I have a feeling this is just an nginx configure issue, i have followed many guides like this: https://chrislea.com/2013/02/23/proxying-websockets-with-nginx/ with no avail. Any help would be greatly appreciated.

Here is my main Nginx conf if that helps:

user www-data;
worker_processes 4;

error_log /var/log/nginx/error.log;
pid logs/nginx.pid;


events {
worker_connections 1024;
}


http {
include mime.types;
default_type application/octet-stream;

sendfile on;
keepalive_timeout 65;
gzip on;

server {
listen 80;
server_name localhost;

location / {
root html;
index index.html index.htm;
}
}

include /etc/nginx/sites-enabled/*;
}

Viewing all articles
Browse latest Browse all 4759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>