Publish emporix-showcase to public instance

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.comhttp://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

Hi Daniel,

I have too little information to help i think. Please read dev documentation in docs/site-middleware and docs/environment-variables files to know more how ulr is created how we handle sites and what can we set.

This ‘main’ is added because it is ‘main’ site name you have set in env variables. It does not appear in URL because most cases we dont want to have site displayed in URL if we only have one site but because architecture supports multi site approach we have site information in app server at all times.

If you still cant resolve this problem then i would need more detailed information to help because it looks clearly like misconfiguration.

You can also try to read docs/logging-guide and apply those logging guidelines to try to pinpoint where/when you encounter redirection loop.

Regards,
Pawel

Hello @Pawel_Bambynek,

found the issue. It was the HTTP version. Must be HTTP2, not the Azure default 1.1.

Best,
Daniel

thats nice :slight_smile: thank you for that input, we will add it to docs :slight_smile: