File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change 2121using MassTransit ;
2222using MassTransit . SqlTransport . PostgreSql ;
2323using Microsoft . AspNetCore . Diagnostics ;
24+ using Microsoft . AspNetCore . HttpOverrides ;
2425using Microsoft . AspNetCore . Mvc ;
2526using Microsoft . IdentityModel . Tokens ;
2627using RobotsTxt ;
4445 . Enrich . FromLogContext ( )
4546 . Enrich . WithClientIp ( )
4647 . Enrich . WithCorrelationId ( headerName : "X-Request-Id" )
47- . Enrich . WithRequestHeader ( "X-Forwarded-For" , "ClientIp" )
4848 . Enrich . WithRequestHeader ( "User-Agent" )
4949 . MinimumLevel . ControlledBy ( logLevelSwitch )
5050 . WriteTo . Console ( ) ;
152152
153153
154154var app = builder . Build ( ) ;
155+ app . UseForwardedHeaders ( new ForwardedHeadersOptions
156+ {
157+ ForwardedHeaders = ForwardedHeaders . XForwardedProto | ForwardedHeaders . XForwardedFor
158+ } ) ;
159+
155160app . UseSerilogRequestLogging ( options =>
156161{
157162 options . EnrichDiagnosticContext = ( diagnosticContext , httpContext ) =>
You can’t perform that action at this time.
0 commit comments