I have an app hosted on Heroku, using Redis Cloud and ActionCable. Locally everything works but on Heroku the user is redirected to a localhost address after a form is submitted. I have tried most of the advice listed here (apart from resque settings since resque gem is not installed): Redis tries to connect to localhost on Heroku instead of REDIS_URL
Redis Cloud was added with
heroku addons:create rediscloud:30
This is in my cable.yml, I have commented out two other solutions that I tried that also did not work (in my actual code, redis url is set to the actual address rather than xxx999)
production:
adapter: redis
# url: <%= ENV.fetch('REDISCLOUD_URL') %>
# url: <%= ENV.fetch("REDISCLOUD_URL") { "redis://localhost:6379/1" } %>
url: <%= ENV.fetch("REDISCLOUD_URL") { "redis://default:xxx999@redis-13674.c77.eu-west-1-1.ec2.cloud.redislabs.com:13674" } %>
channel_prefix: art--collabs_production
In redis.rb:
if ENV["REDISCLOUD_URL"]
$redis = Redis.new(url: ENV["REDISCLOUD_URL"])
end
In production.rb I have the following (again, the commented out code has been tried and also failed)
config.action_cable.url = "ws://www.artcollabs.net/cable"
config.action_cable.allowed_request_origins = [ "http://www.artcollabs.net", "https://www.artcollabs.net" ]
# config.cache_store = :redis_cache_store, { url: ENV.fetch("REDISCLOUD_URL", "redis://localhost:6379/1") }
config.cache_store = :redis_cache_store, { url: ENV.fetch("REDISCLOUD_URL", "redis://default:xxx999@redis-13674.c77.eu-west-1-1.ec2.cloud.redislabs.com:13674") }
Any suggestions on how to solve this?