I have a server running from a binary at localhost:4100 - but by default access to that is public. At localhost:4100 I also get the UI displayed for searching json documents.
I wish to protect localhost:4100 as authenticated_route.
My approach :
basic auth in Phoenix via mix phx.gen.auth
if authenticated β re route to localhost:4100
Phoenix server on localhost:4000 exposed publicly via ngrok.
Alternatively, I could
Use localhost:4100 as backend β receive json response from it and render UI in liveview β but thatβs more tedious, it feels.
Is there a better way to route autenticated traffic to a different port or maybe run two services on same port but different routes?
P.S. at localhost:4100 runs Binary of β > https://www.meilisearch.com/ which provides a nice UI for searching JSON documents.
If I understand correctly - You want Phoenix server to redirect directly to 4100 server post authentication ? (I am assuming re route as redirecting)
Also 4100 server does not have any auth or security ? (I am assuming no auth)
Unless you reverse proxy, it does not secure 4100 server as user can navigate to 4100 server port directly(once he gets to know about its existence and the fact that it has no auth enabled)