revert the preserve host header change as it failed on Antares (#114)

This commit is contained in:
pan-wang 2017-06-21 16:48:38 -07:00 committed by GitHub
parent cee4cf7544
commit 6b411adbd0
3 changed files with 21 additions and 11 deletions

View File

@ -33,6 +33,12 @@ class PROTOCOL_CONFIG
return m_msTimeout; return m_msTimeout;
} }
BOOL
QueryPreserveHostHeader() const
{
return m_fPreserveHostHeader;
}
BOOL BOOL
QueryReverseRewriteHeaders() const QueryReverseRewriteHeaders() const
{ {
@ -84,6 +90,7 @@ class PROTOCOL_CONFIG
private: private:
BOOL m_fKeepAlive; BOOL m_fKeepAlive;
BOOL m_fPreserveHostHeader;
BOOL m_fReverseRewriteHeaders; BOOL m_fReverseRewriteHeaders;
BOOL m_fIncludePortInXForwardedFor; BOOL m_fIncludePortInXForwardedFor;

View File

@ -635,6 +635,8 @@ FORWARDING_HANDLER::GetHeaders(
// this is wrong but Kestrel has dependency on it. // this is wrong but Kestrel has dependency on it.
// should change it in the future // should change it in the future
// //
if (!pProtocol->QueryPreserveHostHeader())
{
if (FAILED(hr = PATH::SplitUrl(pRequest->GetRawHttpRequest()->CookedUrl.pFullUrl, if (FAILED(hr = PATH::SplitUrl(pRequest->GetRawHttpRequest()->CookedUrl.pFullUrl,
&fSecure, &fSecure,
&struDestination, &struDestination,
@ -647,7 +649,7 @@ FORWARDING_HANDLER::GetHeaders(
{ {
return hr; return hr;
} }
}
// //
// Strip all headers starting with MS-ASPNETCORE. // Strip all headers starting with MS-ASPNETCORE.
// These headers are generated by the asp.net core module and // These headers are generated by the asp.net core module and

View File

@ -11,6 +11,7 @@ PROTOCOL_CONFIG::Initialize()
m_fKeepAlive = TRUE; m_fKeepAlive = TRUE;
m_msTimeout = 120000; m_msTimeout = 120000;
m_fPreserveHostHeader = TRUE;
m_fReverseRewriteHeaders = FALSE; m_fReverseRewriteHeaders = FALSE;
if (FAILED(hr = m_strXForwardedForName.CopyW(L"X-Forwarded-For"))) if (FAILED(hr = m_strXForwardedForName.CopyW(L"X-Forwarded-For")))