Deploy to Fly.io using custom domain not working?

I was too hasty in calling it solved!

Changing the PHX_HOST variable to “Wordsmith.pub” definitely fixed by custom domain, but at the cost of breaking the “wordsmith-lml.fly.dev” one.

I was able to get the fly.dev one back working though by adding your check origin suggestion.

In my Phoenix Project, config/config.exs file I added both URLs:

config :wordsmith, WordsmithWeb.Endpoint,
  url: [host: "localhost"],
  check_origin: ["https://wordsmith.pub","https://wordsmith-lml.fly.dev"],
  adapter: Bandit.PhoenixAdapter,
  render_errors: [
    formats: [html: WordsmithWeb.ErrorHTML, json: WordsmithWeb.ErrorJSON],
    layout: false
  ],
  pubsub_server: Wordsmith.PubSub,
  live_view: [signing_salt: "E1HLgpGK"]

So the current state is:

  • PHX_HOST variable in the fly.toml file is set to “wordsmith.pub”
  • I added both URLs to a check origin line.

Let me know if that is totally unkosher! It seems to be working.