vectorfrog
I have a number of domain names that all are going to be lead generation sites with just a landing page and lead capture form. So I’d like to host them all as a single app.
I saw this thread which tells me how to set up the application:
https://forum.elixirforum.com/t/multiple-domains-on-a-single-phoenix-app/32528/5
However, I’m trying to test this solution out locally, and so I’ve used the etc/hosts file to point some domains back to “127.0.0.1”. When I ping the domains, I see that they are indeed hitting up 127.0.0.1. However, my phoenix app only works when I visit “localhost” (I’ve changed the port to execute on port 80). If I pull up “127.0.0.1” in a browser, I get a refused to connect message.
Here’s where things get weird. I can sometimes see that when I go to “dummydomain.com” that I’ve redirected to my machine on the 127.0.0.1 IP, and phoenix will throw a message stating that Plug.SSL is redirecting GET / to https://dummydomain.com with a 301 redirect . However, the application doesn’t load in the browser and I just get the refused to connect message in the browser. But when I open “localhost” everything runs as expected.
I’m guessing I’m just missing a configuration option somewhere, but I can’t figure out what it could be. Any ideas?
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
- #ai
- #ecto-query
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #elixirconf-eu
- #api
- #forms
- #metaprogramming
- #hex











Showing Posts 1 to 3- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
derpycoder
I use etc hosts locally as well, using hostsfile tool, so I can have dev and prod parity:
And then I use a Reverse Proxy, i.e. Caddy to route those to respective ports:
hauleth
Probably your application is listening on IPv6 for some reason, so you need to visit
[::1]instead.vectorfrog
Thanks @derpycoder, setting up a reverse proxy was the missing link. I also deep dived into caddy, which is a pretty cool tool.