In my app i have a ActionCable which is working fine locally, but cannot force it to work on production server.
My stack is:
assets/javascripts/channels/index.coffee
App.cable = ActionCable.createConsumer("/cable")
(function() {
this.App || (this.App = {});
App.cable = ActionCable.createConsumer("/cable")
}).call(this);
mount ActionCable.server => "/cable"
config.action_cable.allowed_request_origins = [/http:\/\/*/, /https:\/\/*/]
server{
server_name subdomain.my-app.app;
passenger_enabled on;
rails_env production;
root /home/deploy/my-app/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;
}
listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/iris.gemisoft.app/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/iris.gemisoft.app/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
# REDIS / ACTIONCABLE
location /cable {
passenger_app_group_name subdomain_my-app_app_websocket;
passenger_force_max_concurrent_requests_per_process 0;
}
}
server {
# if ($host = subdomain.my-app.app) {
# return 301 https://$host$request_uri;
# } # managed by Certbot
listen 80;
listen [::]:80 ipv6only=on;
server_name subdomain.my-app.app;
#return 404; # managed by Certbot
}
Expected behaviour: When Admin click a button, users gets a message.
Current behaviour (on prod): When admin clicks a button, nothing happens, in redis console i can see:
1559571365.936128 [1 127.0.0.1:53530] "publish" "test" "{\"message\":\"message\"}"
Update: cable.yml:
development:
adapter: redis
url: redis://localhost:6379/1
test:
adapter: redis
url: redis://localhost:6379/1
production:
adapter: redis
url: redis://localhost:6379/1
I have found a solution. In my setup i had both jquery_ujs and rails-ujs. Problem solved by removing jquery_ujs.