websockets not connecting in newly deployed Phoenix app in MIA region

Hi, I had my Phoenix Elixir app running in the IAD region just fine. I made a new app to move it to MIA (I first tried moving it, but the machine could not start without the volume, I moved the volume, still wouldn’t start, etc…). The machine starts fine in MIA but websockets are not connecting now, so none of the LiveView functionality is working. I have restarted the machine a couple of times but no joy. Does anyone have an idea what’s going on? Is this something that happens sometimes on fly?

Another piece of the puzzle - it works fine when I use the fly.dev domain. We setup a CNAME record to add an SSL cert for our custom domain, and when I access the site using the CNAME, that’s when the websockets don’t work.

Please provide more details. Is it a client connection issue, are there any error logs on your WS server, etc…

Thanks @khuezy - it’s a client connection issue:

Seeing this in the logs:

2025-08-21T16:06:27Z app[48ed6e0c372358] mia [info]16:06:27.189 [info] CONNECTED TO Phoenix.LiveView.Socket in 41µs
2025-08-21T16:06:27Z app[48ed6e0c372358] mia [info]  Transport: :longpoll
2025-08-21T16:06:27Z app[48ed6e0c372358] mia [info]  Serializer: Phoenix.Socket.V2.JSONSerializer
2025-08-21T16:06:27Z app[48ed6e0c372358] mia [info]  Parameters: %{"_csrf_token" => "Gictc0YeAEYLdDF7JDVTXB4tIzNvLS9evKE6kTYwG3BVlee2ShBa7Hv-", "_live_referer" => "undefined", "_mount_attempts" => "29657", "_mounts" => "0", "_track_static" => %{"0" => "https://status.dblawgroup.com/assets/app-2980010ab6aab1b8b630b0dd6b9082f1.css?vsn=d", "1" => "https://status.dblawgroup.com/assets/app-bc8463e2419b8acba2efb5c2f3970e07.js?vsn=d"}, "vsn" => "2.0.0"}
2025-08-21T16:06:27Z app[48ed6e0c372358] mia [info]16:06:27.247 [error] Could not check origin for Phoenix.Socket transport.
2025-08-21T16:06:27Z app[48ed6e0c372358] mia [info]Origin of the request: https://status.dblawgroup.com
2025-08-21T16:06:27Z app[48ed6e0c372358] mia [info]This happens when you are attempting a socket connection to
2025-08-21T16:06:27Z app[48ed6e0c372358] mia [info]a different host than the one configured in your config/
2025-08-21T16:06:27Z app[48ed6e0c372358] mia [info]files. For example, in development the host is configured
2025-08-21T16:06:27Z app[48ed6e0c372358] mia [info]to "localhost" but you may be trying to access it from
2025-08-21T16:06:27Z app[48ed6e0c372358] mia [info]"127.0.0.1". To fix this issue, you may either:
2025-08-21T16:06:27Z app[48ed6e0c372358] mia [info]  1. update [url: [host: ...]] to your actual host in the
2025-08-21T16:06:27Z app[48ed6e0c372358] mia [info]     config file for your current environment (recommended)
2025-08-21T16:06:27Z app[48ed6e0c372358] mia [info]  2. pass the :check_origin option when configuring your
2025-08-21T16:06:27Z app[48ed6e0c372358] mia [info]     endpoint or when configuring the transport in your
2025-08-21T16:06:27Z app[48ed6e0c372358] mia [info]     UserSocket module, explicitly outlining which origins
2025-08-21T16:06:27Z app[48ed6e0c372358] mia [info]     are allowed:
2025-08-21T16:06:27Z app[48ed6e0c372358] mia [info]        check_origin: ["https://example.com",
2025-08-21T16:06:27Z app[48ed6e0c372358] mia [info]                       "//another.com:888", "//other.com"]

I’m silly - PHX_HOST env var was missing in new app. I will close the issue.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.