How do I configure multiple hosts for Phoenix LiveView?

I have a website that has a URL both with “www.” and without.

When I set host: in config/prod.exs, I must use a string. So whichever URL I don’t use, the socket doesn’t connect so the loading icon prevents the user from interacting with the live view.

How do I workaround this so both URLs work?

image

The check_origin config value is the one that actually limits what you can connect from, and you can configure that to be a list.