Live views fail on www host


I have a live view project, hosted on
I’ve bought a domain and set its A record to IPV4 address, as well as AAAA record to IPV6. Then, I also added CNAME record to enable www support.

Now, the website works perfectly on
But when I go to, it breaks.

The home page has several buttons:

  • some of them are hrefs, leading to other live views; the work fine (as far as I get it, the http request is made when I press them and the live view’s web socket is connected afterwards)
  • others have phx-click binding, that then does push_navigate; this fail (as far as I get it, the web socket tries to do the navigation).
    Console shows me this error:
    WebSocket connection to 'wss://' failed: There was a bad response from the server.

What could be the problem here?

Apparently, the solution is to add both domain and subdomain to check_origin in prod.exs:

config :my_app, MyAppWeb.Endpoint,
  cache_static_manifest: "priv/static/cache_manifest.json",
  check_origin: ["//", "//"]
1 Like