Enable CORS under a .well-known folder

Hello everyone.
I just created a Cloudflare account from my web host (Hostinger). Indeed, I wanted to enable CORS in a .well-known file. So I had created an .htaccess file with the script:

Header set Access-Control-Allow-Origin “*”

However, it didn’t work… So I talked about it with the host’s technical team, who told me to either subscribe to a VPS plan or go through Cloudflare.
That’s why I would like to know if someone could tell me how to proceed with Cloudflare to activate CORS on my website.

Cloudflare will respect the origin’s CORS headers but they won’t appear until the cached version without them expires - or you follow one of the methods from https://developers.cloudflare.com/cache/about/cors/#add-or-change-cors-headers

You could probably use Transform Rules (https://developers.cloudflare.com/rules/transform/) or a Worker (https://developers.cloudflare.com/workers/examples/cors-header-proxy/) to do it within Cloudflare.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.