Answer the question
In order to leave comments, you need to log in
Faye proxying through nginx. How is it done correctly?
Hello.
I'm trying to configure websocket proxying through Nginx. I do as it is written in the official documentation:
location /faye {
proxy_pass http://127.0.0.1:9292;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
Status 101.
Switching protocols
2015/05/29 13:46:38 [info] 27188#0: *32 client closed keepalive connection
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
upstream faye_backend {
server 127.0.0.1:9292;
}
server {
listen 80 default_server deferred;
listen [::]:80 default_server ipv6only=on;
access_log /home/deploy/agrofor/current/log/nginx.access.log;
error_log /home/deploy/agrofor/current/log/nginx.error.log info;
server_name mydomain.com;
passenger_enabled on;
rails_env production;
root /home/deploy/agrofor/current/public;
# redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location ^~ /assets/ {
gzip_static on;
expires max;
add_header Cache-Control public;
}
location /faye {
proxy_pass http://faye_backend;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
}
Answer the question
In order to leave comments, you need to log in
I use the following configuration for node.js faye server:
location /faye {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://127.0.0.1:4000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
break;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question