User unauthorized on nginx subPath

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:

  1. i added a next.config basePath like:
const nextConfig = {
    basePath: '/uv-bs',
};
  1. i adjusted the AUTH0_BASE_URL to ‘http://localhost/uv-bs

  2. 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

A little update on the problem. I found, that when i enter localhost/uv-bs/api/auth/login i succesfully log in and all works fine. So it seems like auth0 does not get, that the login url changed because of both nextjs basePath and also nginx. Thats why i always get redirected to localhost because the app tries to hit localhost/api/auth/login instead.

So i looked up that problem and the official auth0 Github suggested that i update the login and also profile path in my layout within the UserProvider:

<UserProvider loginUrl="/uv-bs/api/auth/login" profileUrl="/uv-bs/api/auth/me">
        <body className={inter.className}>{children}</body>
 </UserProvider>

but for some reason, this gets ignored and my app still tries to enter the path without /uv-bs.

Am i missing something or what did i do wrong?