Hi everyone
I’m having an issue with getting channels to work in production. I’m running an Nginx reverse proxy on an EC2 instance.
I get this error: Error during WebSocket handshake: Unexpected response code: 403
. I’m not sure what the issue is.
I’ve tried many different things, both on here and on Stack Overflow, but nothing seems to work.
Thanks in advance!
Here is my nginx
config (redirects omitted for brevity)
upstream my_site {
server localhost:4000;
}
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 443 ssl http2;
server_name mysite.co.uk;
include snippets/ssl-mysite.co.uk.conf;
include snippets/ssl-params.conf;
location /.well-known {
alias /home/ubuntu/certbot/.well-known;
}
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_redirect off;
proxy_pass http://my_site;
proxy_set_header Host $host;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
prod.ex
use Mix.Config
config :app, AppWeb.Endpoint,
url: [host: "localhost", port: 80],
cache_static_manifest: "priv/static/cache_manifest.json",
config :logger, level: :info
import_config "prod.secret.exs"