lmletham
Hey guys!
I have deployed my Phoenix project to Fly here and set up my DNS records and certs in order to connect to my custom domain here but something is broken.
The fly.dev url works perfectly, but even though my custom domain displays my test text it also throws a “Something went wrong” error..
Fly.io logs say this:
[error] Could not check origin for Phoenix.Socket transport.
[info] Origin of the request: https://wordsmith.pub
[info] This happens when you are attempting a socket connection to
[info] a different host than the one configured in your config/
[info] files. For example, in development the host is configured
[info] to “localhost” but you may be trying to access it from
[info] “127.0.0.1”. To fix this issue, you may either:
[info] 1. update [url: [host: …]] to your actual host in the
[info] config file for your current environment (recommended)
[info] 2. pass the :check_origin option when configuring your
[info] endpoint or when configuring the transport in your
[info] UserSocket module, explicitly outlining which origins
[info] are allowed:
[info] check_origin: [“https://example.com”,
[info] “//another.com:888”, “//other.com”]
I tried to do step 1 by changing the config.exs file in my Phoenix project to add url: [host: "wordsmith.pub"], but that didn’t fix anything and I don’t know how to do the second suggestion.
I didn’t see any documentation on Fly indicating I would have to change my Phoenix files in order to deploy to a custom domain, so I’m not sure what to try next.
My first thought is that this is some kind of DNS record propagation issue. I added the certs and DNS records pointing to the custom domain yesterday morning. So let me know if I simply need to wait longer!
Thanks!
Trending in Questions
Other Trending Topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #blog-post
- #elixirconf-us
- #elixir-ls
- #ai
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 5- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
pdgonzalez872
add
check_origin: ["https://wordsmith.pub"]under the url key in the endpoint configuration.pdgonzalez872
Also, in the docs they mention setting a CNAME as the simplest route.
is there any reason you didn’t go that route? That’s what I’ve done a couple of times.
Your original issue will be fixed with the
check_originkey thoughlmletham
Pretty sure I tried the CNAME option first and messed it up haha so I thought it didn’t work for me. So to answer your question, inexperience.
Thanks for the idea! I actually just tried one last thing and got it working by going into the fly.toml file and changing the PHX_HOST variable from the fly.dev server to my “wordsmtih.pub” domain. Reran
fly deployand it seems to be working beautifully.Thanks for the suggestion! We can probably mark this thread closed.
lmletham
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.exsfile I added both URLs:So the current state is:
check originline.Let me know if that is totally unkosher! It seems to be working.
natewallis
I thought using @ for CNAME wasn’t a good idea since that stops you creating other records on the apex. Maybe there instructions have changed since this was last posted as it seems the advice now is to point A and AAAA to the ipv4 and ipv6 addresses respectively and then use a CNAME for www to point to the fly dev address..