File tree Expand file tree Collapse file tree 1 file changed +2
-6
lines changed
Expand file tree Collapse file tree 1 file changed +2
-6
lines changed Original file line number Diff line number Diff line change 152152
153153
154154var app = builder . Build ( ) ;
155- app . UseForwardedHeaders ( new ForwardedHeadersOptions
156- {
157- ForwardedHeaders = ForwardedHeaders . XForwardedProto | ForwardedHeaders . XForwardedFor
158- } ) ;
159-
160155app . UseSerilogRequestLogging ( options =>
161156{
162157 options . EnrichDiagnosticContext = ( diagnosticContext , httpContext ) =>
163158 {
159+ var proto = httpContext . Request . Headers [ "X-Forwarded-Proto" ] . FirstOrDefault ( ) ?? httpContext . Request . Scheme ;
164160 diagnosticContext . Set ( "RequestHost" , httpContext . Request . Host . Value ) ;
165161 diagnosticContext . Set ( "HttpRequestType" , httpContext . Request . Method ) ;
166- diagnosticContext . Set ( "HttpRequestUrl" , $ "{ httpContext . Request . Scheme } ://{ httpContext . Request . Host } { httpContext . Request . Path } { httpContext . Request . QueryString } ") ;
162+ diagnosticContext . Set ( "HttpRequestUrl" , $ "{ proto } ://{ httpContext . Request . Host } { httpContext . Request . Path } { httpContext . Request . QueryString } ") ;
167163 diagnosticContext . Set ( "HttpRequestId" , httpContext . TraceIdentifier ) ;
168164 } ;
169165} ) ;
You can’t perform that action at this time.
0 commit comments