Hi everyone!
For months now, we have used check_origin
for production in runtime.exs
like :
app_name =
System.get_env("FLY_APP_NAME") ||
raise "FLY_APP_NAME not available"
domain =
System.get_env("DOMAIN") ||
raise "DOMAIN not available"
[...]
config :phoenix_app, PhoenixAppWeb.Endpoint,
server: true,
url: [host: domain, port: 80],
check_origin: [
"https://#{domain}",
"https://#{app_name}.fly.dev"
],
[...]
But now we have the error Could not check origin for Phoenix.Socket transport
in production’s logs.
Complete error log
[info] 09:45:19.943 [error] Could not check origin for Phoenix.Socket transport.
[info] Origin of the request: https://[Our domain]
[info] This happens when you are attempting a socket connection to
[info] a different host than the one configured in your config/
[info] files. For example, in development the host is configured
[info] to "localhost" but you may be trying to access it from
[info] "127.0.0.1". To fix this issue, you may either:
[info] 1. update [url: [host: ...]] to your actual host in the
[info] config file for your current environment (recommended)
[info] 2. pass the :check_origin option when configuring your
[info] endpoint or when configuring the transport in your
[info] UserSocket module, explicitly outlining which origins
[info] are allowed:
[info] check_origin: ["https://example.com",
[info] "//another.com:888", "//other.com"]
Do you know what could have changed and how I can fix it?
Thanks for your help !