Index: Source/core/loader/DocumentThreadableLoader.cpp |
diff --git a/Source/core/loader/DocumentThreadableLoader.cpp b/Source/core/loader/DocumentThreadableLoader.cpp |
index 8c9c383ac54ff1ae158e2b367a37f20d409f28e4..dc04c2d83f313c5810ce0d5963c7ebab898ef67c 100644 |
--- a/Source/core/loader/DocumentThreadableLoader.cpp |
+++ b/Source/core/loader/DocumentThreadableLoader.cpp |
@@ -99,12 +99,14 @@ void DocumentThreadableLoader::makeCrossOriginAccessRequest(const ResourceReques |
ASSERT(m_options.crossOriginRequestPolicy == UseAccessControl); |
OwnPtr<ResourceRequest> crossOriginRequest = adoptPtr(new ResourceRequest(request)); |
- updateRequestForAccessControl(*crossOriginRequest, securityOrigin(), m_options.allowCredentials); |
- if ((m_options.preflightPolicy == ConsiderPreflight && isSimpleCrossOriginAccessRequest(crossOriginRequest->httpMethod(), crossOriginRequest->httpHeaderFields())) || m_options.preflightPolicy == PreventPreflight) |
+ if ((m_options.preflightPolicy == ConsiderPreflight && isSimpleCrossOriginAccessRequest(crossOriginRequest->httpMethod(), crossOriginRequest->httpHeaderFields())) || m_options.preflightPolicy == PreventPreflight) { |
+ updateRequestForAccessControl(*crossOriginRequest, securityOrigin(), m_options.allowCredentials); |
makeSimpleCrossOriginAccessRequest(*crossOriginRequest); |
- else { |
+ } else { |
m_simpleRequest = false; |
+ // Do not set the Origin header for preflight requests. |
+ updateRequestForAccessControl(*crossOriginRequest, 0, m_options.allowCredentials); |
m_actualRequest = crossOriginRequest.release(); |
if (CrossOriginPreflightResultCache::shared().canSkipPreflight(securityOrigin()->toString(), m_actualRequest->url(), m_options.allowCredentials, m_actualRequest->httpMethod(), m_actualRequest->httpHeaderFields())) |