Hello everyone,
i have two NextJS applications running on Docker. App A (app_dashboard) is on port 3000 and app B (app_uv_bs) on port 3001.
Now i have configured my nginx conf as follows:
listen 80;
listen [::]:80;
server_name localhost;
location / {
proxy_pass http://app_dashboard:3000;
proxy_http_version 1.1;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
# For the UV_BS app running on port 3001
location /uv-bs {
proxy_pass http://app_uv_bs:3001;
proxy_http_version 1.1;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
In order to make the second app run on the subpath /uv-bs i made these changes:
- i added a next.config basePath like:
const nextConfig = {
basePath: '/uv-bs',
};
-
i adjusted the AUTH0_BASE_URL to ‘http://localhost/uv-bs’
-
in my Auth0 Dashboard i added:
Now without enginx both apps communicate perfectly with eachother (i have all the URLS set up for this case). But when i run the nginx, the app_dashboard on port 3000 works perfectly on localhost. i can login and read all the uder data is need. Now when i navigate to localhost/uv-bs the login mask comes up. when i log in i get an error:
{"error":"not_authenticated","description":"The user does not have an active session or is not authenticated"}
navigating to http://localhost/uv-bs/api/auth/me returns the same. My Container throws invalid user session when i try to get the session but im authenticated on the root localhost and can access all protected pages there.
There must be some missconfiguration with the app on the nginx subpath but i cant figure it out.
Any help is appreciated