Skip to content

Commit

Permalink
Set Origin HTTP header during CORS (#10700)
Browse files Browse the repository at this point in the history
* Set Origin HTTP header during CORS

* Change files
  • Loading branch information
JunielKatarn committed Dec 7, 2022
1 parent d248920 commit 4d279cd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "Set Origin HTTP header during CORS",
"packageName": "react-native-windows",
"email": "julio.rocha@microsoft.com",
"dependentChangeType": "patch"
}
5 changes: 5 additions & 0 deletions vnext/Shared/Networking/OriginPolicyHttpFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -754,6 +754,11 @@ ResponseOperation OriginPolicyHttpFilter::SendRequestAsync(HttpRequestMessage co
ValidatePreflightResponse(coRequest, preflightResponse);
}

if (originPolicy == OriginPolicy::SimpleCrossOriginResourceSharing ||
originPolicy == OriginPolicy::CrossOriginResourceSharing) {
coRequest.Headers().Insert(L"Origin", s_origin.AbsoluteCanonicalUri());
}

auto response = co_await m_innerFilter.SendRequestAsync(coRequest);

ValidateResponse(response, originPolicy);
Expand Down

0 comments on commit 4d279cd

Please sign in to comment.