Custom urls for multiple Phoenix applications in development

I have an app that contains multiple phoenix applications in umbrella each one started on a different port.
I development I can access each app like this:

[info] Running Phoenix1Web.Endpoint with Cowboy using http://0.0.0.0:4000
[info] Running Phoenix2Web.Endpoint with Cowboy using http://0.0.0.0:4001

How can I access this applications in development with a more friendly url. Something like:

test1.example.dev
test2.example.dev

I tried using /etc/hosts file but without luck because I can not change the port in there.
I know that I can do it with nginx but I am looking if there is an easier solution. Something like pow does for Rack applications.

You could set up a reverse proxy yourself (e. g. with nginx) or try a simple-to-use forwarding tool like ergo. I haven’t tried it myself but it looks pretty neat.

You can give it a port and use it as a proxy with:

echo 4000 > ~/.pow/test1.example
echo 4001 > ~/.pow/test2.example

I use puma-dev rather than pow as it supports websockets and https

1 Like

It worked.
Thank you.