Skip to content

Commit

Permalink
Disable CORS preflight request upon command line flag
Browse files Browse the repository at this point in the history
We were still sending preflight request even when cors is disabled by
dev flag.

b/27175039

Change-Id: Ib8dba31d581c44f77e623742b565ed9396448ea1
  • Loading branch information
johnxwork committed Aug 7, 2024
1 parent e8394fe commit 731b57d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cobalt/loader/cors_preflight.cc
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,9 @@ bool CORSPreflight::IsPreflightNeeded() {
if (force_preflight_) {
return true;
}
if (cors_policy_ == network::kCORSOptional) {
return false;
}
// Preflight is not needed if the request method is CORS-safelisted request
// method and all headers are CORS-safelisted request-header.
std::vector<std::string> unsafe_headers;
Expand Down

0 comments on commit 731b57d

Please sign in to comment.