-
I'm pretty sure I'm holding something wrong, but is there any special configuration to be done for Traefik to support ActionCable websockets? My configuration works locally in development but I'm getting an The request indicates it's trying to connect to This may be a mistake in how I configure ActionCable in general or a combination of ActionCable and Traefik. This is the first time I'm using ActionCable. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Is anyone else using ActionCable with Traefick or has an idea how to debug this? |
Beta Was this translation helpful? Give feedback.
-
I'm having the same issue, I think I have it narrowed down to the fact that my webapp can't reach redis (running on a seperate server, in the same VPC). From what I can tell, I can reach redis from my webapp's host, but not within the docker container. I'll let you know if/when I find out more. |
Beta Was this translation helpful? Give feedback.
-
I got it to work using the following configuration. Note that I'm also using traefik to terminate HTTPS (with let's encrypt), so your mileage may vary. # deploy.yml
# ...
# Deploy to these servers.
servers:
web:
hosts:
- 192.0.2.0
labels:
traefik.http.routers.kiqr_cloud_secure.entrypoints: websecure
traefik.http.routers.kiqr_cloud_secure.rule: Host(`example.com`)
traefik.http.routers.kiqr_cloud_secure.tls: true
traefik.http.routers.kiqr_cloud_secure.tls.certresolver: letsencrypt
# Credentials for your image host.
registry:
# Specify the registry server, if you're not using Docker Hub
server: containers.example.com
username: nerdinand
password:
- KAMAL_REGISTRY_PASSWORD
# Inject ENV variables into containers (secrets come from .env).
env:
clear:
POSTGRES_HOST: 192.0.2.0
POSTGRES_USER: postgres
REDIS_URL: redis://192.0.2.0:6379/1
secret:
- RAILS_MASTER_KEY
- POSTGRES_PASSWORD
# Use accessory services (secrets come from .env).
accessories:
postgres:
image: postgres:16
host: 192.0.2.0
port: 5432
env:
clear:
POSTGRES_USER: postgres
secret:
- POSTGRES_PASSWORD
directories:
- data/db:/var/lib/postgresql/data
redis:
image: redis:7
host: 192.0.2.0
port: 6379
directories:
- data/redis:/var/lib/redis/data
traefik:
options:
publish:
- "443:443"
volume:
- "/letsencrypt/acme.json:/letsencrypt/acme.json"
args:
entryPoints.websecure.address: ":443"
certificatesResolvers.letsencrypt.acme.email: "[email protected]"
certificatesResolvers.letsencrypt.acme.storage: "/letsencrypt/acme.json"
certificatesResolvers.letsencrypt.acme.httpchallenge: true
certificatesResolvers.letsencrypt.acme.httpchallenge.entrypoint: web
I also removed config.action_cable.url = 'wss://example.com/cable'
config.action_cable.allowed_request_origins = ['https://example.com'] Hopefully that helps. |
Beta Was this translation helpful? Give feedback.
I got it to work using the following configuration. Note that I'm also using traefik to terminate HTTPS (with let's encrypt), so your mileage may vary.