ASP.NET Core Behind Nginx Sees `http://` Scheme & 127.0.0.1 Remote IP
`UseForwardedHeaders()` missing or proxy IP not added to `KnownProxies`.
Runs locally in browser
Free · No login
Independently Verified 2026-11-25
v4.1.0
Identifier: ASP.NET Core Behind Nginx Sees `http
Platform: DotNet
Common Root Causes:
- `UseForwardedHeaders()` missing or proxy IP not added to `KnownProxies`.
Interactive Diagnostic Checklist
Verified Solutions:
- Register `ForwardedHeadersMiddleware` before auth/HTTPS redirection and configure Nginx proxy headers.
Safe Diagnostic Command:
Inspect Request.Scheme and X-Forwarded-Proto
Warning: Verify configuration changes in staging or with dry-run flags (e.g. nginx -t) before reloading production services.
Technical Explanation
`UseForwardedHeaders()` missing or proxy IP not added to `KnownProxies`. Recommended diagnostic: `Inspect Request.Scheme and X-Forwarded-Proto`. Remediation: Register `ForwardedHeadersMiddleware` before auth/HTTPS redirection and configure Nginx proxy headers.
Worked Examples
- Run `Inspect Request.Scheme and X-Forwarded-Proto` to verify root cause before applying the remediation.
Limitations & Assumptions
- Always verify configuration changes in staging or with dry-run flags (e.g. `nginx -t`) before reloading production services.
Source References & Verification
Resource ID: err-dotnet-forwarded-headers-https-loop · Independently verified: 2026-11-25