Skip to content

v3.1.1 — Fix reverse-proxy redirects & middleware activation

Choose a tag to compare

@dinhdobathi1992 dinhdobathi1992 released this 08 Mar 17:26
· 150 commits to main since this release

Bug Fixes

Redirects go to 0.0.0.0:3000 behind reverse proxy (#3)

All NextResponse.redirect() calls used new URL("/path", req.url) which resolves to the container's internal address (http://0.0.0.0:3000) when deployed behind NGINX ingress. A new publicUrl() helper reconstructs the external origin from x-forwarded-proto + x-forwarded-host headers set by the reverse proxy.

Middleware was never active

The auth middleware lived in src/proxy.ts exporting proxy(). Next.js requires src/middleware.ts exporting middleware(). Renamed and re-exported so auth guards, HTTP→HTTPS redirect, and route protection actually run.

Helm chart uses wrong ingress class

Replaced ALB ingress annotations with NGINX ingress annotations matching the cluster's installed controller (internal-ingress-nginx). Removed certificateArn ALB-specific template logic.

Files Changed

File Change
src/lib/url.ts New — publicUrl() helper
src/proxy.ts → src/middleware.ts Renamed + export as middleware()
src/app/api/auth/callback/route.ts 8 redirects → publicUrl()
src/app/api/auth/login/route.ts 1 redirect → publicUrl()
src/app/api/auth/logout/route.ts 1 redirect → publicUrl()
src/app/api/auth/setup/route.ts 2 redirects → publicUrl()
helm/gitdash/values.yaml ALB → NGINX ingress config
helm/gitdash/templates/ingress.yaml Remove ALB certificateArn block

Full Changelog: v3.1.0...v3.1.1