You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to configure ActionCable in Rails 6.1.4.1 to run on a subdomain, but when I follow these instructions the env["warden"] (which is used by Devise) is nil in app/channels/application_cable/connection.rb.
This post will explain my environment/configuration for my attempts at getting things to work with a custom Rackup file, and then it will explain the changes I made to get things working. I've separated the sections with horizontal lines, for easier skimming.
This is a rather long post, so I want to thank you ahead of time for even reading this far.
ActionCable is fully functional outside of any channels that expect authentication (so anything that is not using env["warden"])
ActionCable is fully functional (including use of env["warden"]) if I do not use a subdomain (if I use a location /cable block within my main server block)
The site itself (main domain & subdomain) is fully functional - I can log into the site & visit either main or subdomain and be logged into both
I have the main domain (and www) proxied through CloudFlare, but I do not have the actioncable subdomain proxied.
My web infrastructure consists of a single EC2 instance.
This effectively means that I'm running two instances of my Rails app, so if I want to keep traffic out of the subdomain, I can also add a redirect before the location /cable line, resulting in this server block:
An aside: I don't understand why none of the ssl-related lines are required in my ActionCable server instance. 🤷 Everything works without specifying ssl_certificate etc within that ActionCable server block.
The text was updated successfully, but these errors were encountered:
I am trying to configure ActionCable in Rails 6.1.4.1 to run on a subdomain, but when I follow these instructions the
env["warden"]
(which is used by Devise) is nil inapp/channels/application_cable/connection.rb
.This post will explain my environment/configuration for my attempts at getting things to work with a custom Rackup file, and then it will explain the changes I made to get things working. I've separated the sections with horizontal lines, for easier skimming.
This is a rather long post, so I want to thank you ahead of time for even reading this far.
env["warden"]
)env["warden"]
) if I do not use a subdomain (if I use alocation /cable
block within my main server block)I have the main domain (and www) proxied through CloudFlare, but I do not have the actioncable subdomain proxied.
My web infrastructure consists of a single EC2 instance.
I have ActionCable mounted in my routes file:
I have the session_store set to share across subdomains, and the URL & allowed_request_origins set in my production.rb file:
I have a
cable/config.ru
file specifically for the ActionCable server:My Nginx config forces SSL & non-www, and runs ActionCable separately:
Things do work properly if I comment out these custom Rackup file lines in the ActionCable server in nginx:
This effectively means that I'm running two instances of my Rails app, so if I want to keep traffic out of the subdomain, I can also add a redirect before the
location /cable
line, resulting in this server block:An aside: I don't understand why none of the ssl-related lines are required in my ActionCable server instance. 🤷 Everything works without specifying
ssl_certificate
etc within that ActionCable server block.The text was updated successfully, but these errors were encountered: