I have an chat application deployed to a vps with Puma and Nginx 1.10 my nginx config is the following:
upstream websocket {
server 127.0.0.1:28080;
}
server {
location /cable {
proxy_pass http://websocket/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}
}
This is my config.ru file for cable:
require ::File.expand_path('../../config/environment', __FILE__)
Rails.application.eager_load!
ActionCable.server.config.disable_request_forgery_protection = true
run ActionCable.server
In environment/production.rb
config.action_cable.allowed_request_origins = ['http://ahu.mydomain.ir', 'https://ahu.mydomain.ir']
config.action_cable.url = "ws://ahu.mydomain.ir/cable"
My client connected to internet via a proxy server and in chrome console i get the following error:
WebSocket connection to 'ws://ahu.mydomain.ir/cable' failed: Establishing a tunnel via proxy server failed
In another client without proxy every thing is OK.