Skip to content

Commit 75d38cc

Browse files
authored
Merge pull request #1 from alleyinteractive/handle-preflight-options
Add handling for preflight OPTIONS request
2 parents 420d054 + d4545b5 commit 75d38cc

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

wp-includes/rest-api/auth/class-wp-rest-token.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,12 @@ public function require_token() {
394394
$require_token = false;
395395
}
396396

397+
// Don't require a token or Authorization header for preflight OPTIONS
398+
// requests.
399+
if ( 'OPTIONS' === $request_method ) {
400+
$require_token = false;
401+
}
402+
397403
/**
398404
* GET requests do not typically require authentication, but if the
399405
* Authorization header is provided, we will use it. What's happening

0 commit comments

Comments
 (0)