What is the name of the domain?
What is the error number?
403
What is the error message?
HTTP/2 403 Content-Type: text/html Access-Control-Allow-Origin: *
What is the issue you’re encountering
Verified that the origin server (S3) responds with 200 for the same request when bypassing Cloudflare. Disabled caching for this specific resource and purged the cache. Added custom firewall rules to explicitly allow the OPTIONS method for the specific path. Tested using a Cloudflare Worker, and the issue was resolved with the following Worker code: addEventListener(‘fetch’, event => { const request = event.request; if (request.method === ‘OPTIONS’) { event.respondWith( new Response(null, { status: 200, headers: { ‘Access-Control-Allow-Origin’: ‘*’, ‘Access-Control-Allow-Methods’: ‘GET, OPTIONS’, ‘Access-Control-Allow-Headers’: ‘Content-Type’, }), }) ); } else { event.respondWith(fetch(request)); } }); However, I want to avoid using Workers due to the high volume of requests.
What steps have you taken to resolve the issue?
Hello Cloudflare Community,
I am encountering a persistent issue where Cloudflare responds with a 403 Forbidden for a CORS preflight OPTIONS request, but the logs show a 200 OK. Interestingly, this issue does not occur when I use a Cloudflare Worker to handle the request, which works perfectly. The resource is hosted on Amazon S3, and when I bypass Cloudflare and hit the S3 endpoint directly, the request works correctly with a 200 response.
Here’s the situation in detail:
The request is made to a subdomain on Cloudflare, and the origin is hosted on S3.
The method used is OPTIONS with Origin, Access-Control-Request-Method, and Access-Control-Request-Headers headers.
Despite Cloudflare showing a 200 OK in the logs, the actual client response is 403 Forbidden.
What are the steps to reproduce the issue?
Make a preflight OPTIONS request to the Cloudflare-protected domain with the appropriate headers:
Origin
Access-Control-Request-Method
Access-Control-Request-Headers
Observe that the response from Cloudflare is HTTP/2 403 Forbidden.
Test the same request directly to the S3 bucket (bypassing Cloudflare), and observe a 200 OK response with the correct CORS headers.