Running NextJS with Auth0 behind a Proxy

Hey folks,

i have a NextJS 14 app with Auth0 that runs perfectly on local. Now i deployed my app to a virtual Server of my company. The problem seems to be, that this server is behind a proxy. In order to run the Docker container with my app, i pass env variables like this:

docker run -d -p 8443:3000 -e HTTP_PROXY=“$HTTP_PROXY” -e HTTPS_PROXY=“$HTTPS_PROXY” -e NO_PROXY=“$NO_PROXY” --env-file /home/docker/config/auth0.env registry.gitlab.com/my-group/my-repo:feature-login

i can validate that these variables are inside the container and from that container a curl -v to my auth0 domain /.well-known/openid-configuration works perfectly.

but if i run my app and click on login the urls moves to http://10.27.249.4:8443/api/auth/login?returnTo=%2Fdashboard instead of the auth0 login page. The docker logs show the following message.

[LoginHandlerError]: Login handler failed. CAUSE: Discovery requests failing for https://my-domain.eu.auth0.com.

Is my assumption correct that this is because of the proxy? Also it seems that the docker env variables are not enough. do i need to adjust my nextJS code to handle the proxy?

Your help is very appreciated

1 Like