diff --git a/config/cable.yml b/config/cable.yml index c29230ed7..1dd3fdd79 100644 --- a/config/cable.yml +++ b/config/cable.yml @@ -1,7 +1,7 @@ # Action Cable uses Redis by default to administer connections, channels, and sending/receiving messages over the WebSocket. production: adapter: redis - url: <%= ENV["REDISCLOUD_URL"] %> + url: <%= ENV["REDIS_URL"] %> development: adapter: redis diff --git a/config/environments/production.rb b/config/environments/production.rb index 3be9a24fb..51d84e643 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -1,3 +1,18 @@ + +class ChatActionCable + def initialize(app, options={}) + @app = app + end + + def call(env) + if Faye::WebSocket.websocket?(env) + ActionCable.server.call(env) + else + @app.call(env) + end + end +end + Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. @@ -38,9 +53,6 @@ # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX - # Action Cable endpoint configuration - # config.action_cable.url = 'wss://example.com/cable' - # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. config.force_ssl = true @@ -85,4 +97,13 @@ # Do not dump schema after migrations. config.active_record.dump_schema_after_migration = false + + # Action Cable endpoint configuration + config.action_cable.url = 'wss://www.reactrails.com/cable' + config.action_cable.allowed_request_origins = ['https://www.reactrails.com', 'http://www.reactrails.com'] + + + + + end