File tree 3 files changed +22
-12
lines changed 3 files changed +22
-12
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,12 @@ class PROTOCOL_CONFIG
33
33
return m_msTimeout;
34
34
}
35
35
36
+ BOOL
37
+ QueryPreserveHostHeader () const
38
+ {
39
+ return m_fPreserveHostHeader;
40
+ }
41
+
36
42
BOOL
37
43
QueryReverseRewriteHeaders () const
38
44
{
@@ -84,6 +90,7 @@ class PROTOCOL_CONFIG
84
90
private:
85
91
86
92
BOOL m_fKeepAlive;
93
+ BOOL m_fPreserveHostHeader;
87
94
BOOL m_fReverseRewriteHeaders;
88
95
BOOL m_fIncludePortInXForwardedFor;
89
96
Original file line number Diff line number Diff line change @@ -635,19 +635,21 @@ FORWARDING_HANDLER::GetHeaders(
635
635
// this is wrong but Kestrel has dependency on it.
636
636
// should change it in the future
637
637
//
638
- if (FAILED (hr = PATH::SplitUrl (pRequest->GetRawHttpRequest ()->CookedUrl .pFullUrl ,
639
- &fSecure ,
640
- &struDestination,
641
- &struUrl)) ||
642
- FAILED (hr = strTemp.CopyW (struDestination.QueryStr ())) ||
643
- FAILED (hr = pRequest->SetHeader (HttpHeaderHost,
644
- strTemp.QueryStr (),
645
- static_cast <USHORT>(strTemp.QueryCCH ()),
646
- TRUE ))) // fReplace
647
- {
648
- return hr;
638
+ if (!pProtocol->QueryPreserveHostHeader ())
639
+ {
640
+ if (FAILED (hr = PATH::SplitUrl (pRequest->GetRawHttpRequest ()->CookedUrl .pFullUrl ,
641
+ &fSecure ,
642
+ &struDestination,
643
+ &struUrl)) ||
644
+ FAILED (hr = strTemp.CopyW (struDestination.QueryStr ())) ||
645
+ FAILED (hr = pRequest->SetHeader (HttpHeaderHost,
646
+ strTemp.QueryStr (),
647
+ static_cast <USHORT>(strTemp.QueryCCH ()),
648
+ TRUE ))) // fReplace
649
+ {
650
+ return hr;
651
+ }
649
652
}
650
-
651
653
//
652
654
// Strip all headers starting with MS-ASPNETCORE.
653
655
// These headers are generated by the asp.net core module and
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ PROTOCOL_CONFIG::Initialize()
11
11
12
12
m_fKeepAlive = TRUE ;
13
13
m_msTimeout = 120000 ;
14
+ m_fPreserveHostHeader = TRUE ;
14
15
m_fReverseRewriteHeaders = FALSE ;
15
16
16
17
if (FAILED (hr = m_strXForwardedForName.CopyW (L" X-Forwarded-For" )))
You can’t perform that action at this time.
0 commit comments