When deploy the emporix-showcase I get a ERR_TOO_MANY_REDIRECTS when opening a product detail page. On localhost it works without these issue.
I’m using a docker-based Azure deployment.
Any hints which environment or configuration setting I can check?
Best,
Daniel
hi, for starters check your env variables. I would recommend 1st checking NEXTAUTH_URL=https://your-actual-domain.com as from description of ‘works locally’ it looks like you are trying to redirect to localhost.
When NEXTAUTH_URL points to localhost, NextAuth constructs redirect URLs to localhost, the browser can’t reach it, and the middleware loop begins.
If that doesnt help try checking forwarding headers:
- AUTH_TRUST_HOST=true Without this, NextAuth may generate redirect URLs with the wrong host/protocol, causing loops.
- Check if your Azure configuration passes
X-Forwarded-Proto, X-Forwarded-Host, and X-Forwarded-For correctly to the container.
NEXTAUTH_URL and NEXTAUTH_URLwas already adapted by for the environment.
I added AUTH_TRUST_HOST but still same issue.
X-Forwarded-Proto, X-Forwarded-Host, and X-Forwarded-For should be passed automatically, I believe.
can you check if headers are properly attached ? maybe something like this in azure container:
curl -v -H “Host: your-domain.com” http://localhost:3000/main/en/product/some-id 2>&1 | grep -i “location|x-forwarded” ?
you can also check **NEXT_PUBLIC_SITE_ROUTING_CONFIG
default**routing config has a hardcoded domain showcase.emporix.la. If your Azure domain doesn’t match, the domain-based routing resolution falls through to the fallback path, which could interact poorly with cookie-based site resolution.
Logging inside the container ist currently not possible. But what I saw:
The x-middleware-rewrite header is try to redirect to url that included “main”.
Example:
location: https://my-domain.com/de/product/name
x-middleware-rewrite: https://my-domain.com/main/de/product/name
I think this causes the redirect loop.
NEXT_PUBLIC_SITE_ROUTING_CONFIG=default
NEXT_PUBLIC_DEFAULT_SITE=main
NEXT_PUBLIC_AVAILABLE_SITES=main,us-branch
Best,
Daniel