Skip to content
This repository was archived by the owner on Jun 20, 2019. It is now read-only.

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

Merged
merged 1 commit into from
Jun 21, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/AspNetCore/Inc/protocolconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ class PROTOCOL_CONFIG
return m_msTimeout;
}

BOOL
QueryPreserveHostHeader() const
{
return m_fPreserveHostHeader;
}

BOOL
QueryReverseRewriteHeaders() const
{
Expand Down Expand Up @@ -84,6 +90,7 @@ class PROTOCOL_CONFIG
private:

BOOL m_fKeepAlive;
BOOL m_fPreserveHostHeader;
BOOL m_fReverseRewriteHeaders;
BOOL m_fIncludePortInXForwardedFor;

Expand Down
26 changes: 14 additions & 12 deletions src/AspNetCore/Src/forwardinghandler.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
return hr;
if (!pProtocol->QueryPreserveHostHeader())
{
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
Expand Down
1 change: 1 addition & 0 deletions src/AspNetCore/Src/protocolconfig.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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")))
Expand Down