Want to run FusionAuth and the backend app in Docker
-
Hiya,
I want to run FusionAuth and the backend app in Docker, but run into an issue with this quickstart: https://github.com/FusionAuth/fusionauth-quickstart-javascript-express-web/
When I modify the complete-application/.env file to have the value for
fusionAuthURL=http://localhost:9011
the token exchange fails (because the dockerized express app doesn't know how to get to FusionAuth).When I set
fusionAuthURL=http://fusionauth:9011
wherefusionauth
is the internal docker network domain name of the FusionAuth server, the initial redirect fails, because my browser doesn't know about that domain (not being in Docker).How can I fix this?
-
You can create two values for the FusionAuth url:
internalFusionAuthURL="http://fusionauth:9011" externalFusionAuthURL="http://localhost:9011"
So basically whenever you are sending the redirect to the browser (pretty much just the authorize and logout URLs) you use externalFusionAuthURL which references localhost.
When you are communicating with FusionAuth from the application backend (the express app) you use the internalFusionAuthURL which references the docker domain name.
I tested that out and it seems to work fine.
Give that a try.
-
D dan has marked this topic as solved