To expand on this, Phoenix enforces same origin for websockets by default, (check_origin: true
endpoint config). By default, we will enforce the same origin as configured in your :url
, but you can also provide a list of hosts if you have other needs. For example:
config :my_app, MyAppWeb.Endpoint,
check_origin: ["//example.com", "//another.com"]
For applications generated with phx.new
>= 1.6.3, the config/runtime.exs
will use a PHX_HOST
environment export if available to set the endpoint url host, and fly.toml
which is set to myapp.fly.dev
when you run fly launch
, and can be customized as you add your custom domains. Glad you got things sorted and hope that helps!