Hello
I have set up a custom domain for my app using A records according to the docs:
https://fly.io/docs/getting-started/working-with-fly-apps/#fly-and-custom-domains
When I write my domain name in the browser it loads my app but the URL address quickly switches back to *.fly.dev domain. What am I missing?
Hey! Can you send your app name here or in DM? Thanks.
Thanks. What’s the domain?
nentech.pl and www.nentech.pl
OK, so this works for me https://nentech.pl. But http://nentech.pl
redirects. What’s your application built in? This looks like a ‘force TLS’ type redirect that some frameworks enable by default.
Elixir/Phoenix
This is just a guess, but do you have a config that looks something like this?
config :hello, HelloWeb.Endpoint,
url: [host: "example.com"],
force_ssl: [rewrite_on: [:x_forwarded_proto]]
If so, the host set here will be used for the target of the SSL redirect. To use the current host instead, change force_ssl
to:
force_ssl: [rewrite_on: [:x_forwarded_proto], host: nil]
Thank you. I will check that
Once again thanks. That solved the problem:
force_ssl: [rewrite_on: [:x_forwarded_proto], host: nil]
Hi, can you help me too.
My app - wandering-fire-179 and pointing to https://undionline.com
The problem is, it does not finish fetching
@dev-rroslan I’m hitting https://undionline.com and getting a full response — do you have a little more information? Do you mean one of the secondary requests is taking too long? Or is the site not loading for you at all?
It’s ok now. added check_origin in rentime.exs
Note: This solution…
force_ssl: [rewrite_on: [:x_forwarded_proto], host: nil]
… also fixes the LiveView infinite refresh problem described in Phoenix LiveView constantly refreshes with custom domain - #10 by stibbs . However this solution solves the endpoint issue in that link as well.
Also note: I noticed this URL redirect problem in Chrome but not Edge!
I’d just like to add that I had this issue with a Wordpress site.
The problem was that I had originally set up WP with the .dev domain so I could configure it before redirecting the domain. Then I forgot to set the new domain in the Wordpress settings!
Settings > General > Wordpress Address/Site Address