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;
}
BOOL
QueryPreserveHostHeader() const
{
return m_fPreserveHostHeader;
}
BOOL
QueryReverseRewriteHeaders() const
{
@ -84,6 +90,7 @@ class PROTOCOL_CONFIG
private:
BOOL m_fKeepAlive;
BOOL m_fPreserveHostHeader;
BOOL m_fReverseRewriteHeaders;
BOOL m_fIncludePortInXForwardedFor;

View File

@ -635,19 +635,21 @@ FORWARDING_HANDLER::GetHeaders(
// this is wrong but Kestrel has dependency on it.
// should change it in the future
//
if (FAILED(hr = PATH::SplitUrl(pRequest->GetRawHttpRequest()->CookedUrl.pFullUrl,
&fSecure,
&struDestination,
&struUrl)) ||
FAILED(hr = strTemp.CopyW(struDestination.QueryStr())) ||
FAILED(hr = pRequest->SetHeader(HttpHeaderHost,
strTemp.QueryStr(),
static_cast<USHORT>(strTemp.QueryCCH()),
TRUE))) // fReplace
if (!pProtocol->QueryPreserveHostHeader())
{
return hr;
if (FAILED(hr = PATH::SplitUrl(pRequest->GetRawHttpRequest()->CookedUrl.pFullUrl,
&fSecure,
&struDestination,
&struUrl)) ||
FAILED(hr = strTemp.CopyW(struDestination.QueryStr())) ||
FAILED(hr = pRequest->SetHeader(HttpHeaderHost,
strTemp.QueryStr(),
static_cast<USHORT>(strTemp.QueryCCH()),
TRUE))) // fReplace
{
return hr;
}
}
//
// Strip all headers starting with MS-ASPNETCORE.
// These headers are generated by the asp.net core module and

View File

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