fix: add DOUJIN_MANAGER_FORCE_HTTPS fallback for multi-layer proxies #29
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/openapi-force-https-fallback"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
The OpenAPI document still advertises
http://URLs even though PR #21 (merged) addedForwardedHeaders+ProxyAwareServerTransformer. Root cause: in a multi-layer proxy chain,X-Forwarded-Protogets lost.The Synology RP terminates TLS and forwards plain HTTP to Umbrel Nginx without forwarding
X-Forwarded-Proto: https. The Umbrel Nginx then setsX-Forwarded-Proto $scheme(which ishttp), so the app never seeshttps.Verified locally
The existing code is correct when headers arrive — I tested it:
The problem is purely that the header doesn't reach the app through the layered proxy chain, and the Umbrel Nginx config can't be easily modified (Umbel manages it).
Fix
Added
DOUJIN_MANAGER_FORCE_HTTPS=trueenv var — a tiny middleware that forcesRequest.Scheme = "https"afterForwardedHeadersruns. This is the pragmatic solution for proxy chains where you can't control headers at every hop.The middleware runs between
UseForwardedHeaders()andUseRestAdapterMiddleware(), so the rest of the pipeline (includingProxyAwareServerTransformer) seeshttps.File changed
Program.cs— 16 lines: read env var, register scheme-override middlewareAll 246 tests pass.
Summary
Summary
Coverage
DoujinManager.ApplicationCore - 84.8%
DoujinManager.Infrastructure - 91.6%
pshot
DoujinManager.RestAdapter - 84.2%
E5CB12CEAC5BBBEA65844E1C05F9ADA4DA38B848075C41304FC6A1ABF77__ValidationAttr
ibuteCache
DoujinManager.Server - 21.5%
Pull request closed