The .txt file is served as expected, with both HTTP headers from the _headers file sent with it. However Pages is also sending an Access-Control-Allow-Origin: * header with every response.
As I understand from the Pages docs, one’d have to explicitly set said header in the _headers file for it to appear in the reponse:
To enable other domains to fetch every asset from your Pages project, the following can be added to the _headers:
_headers
/*
Access-Control-Allow-Origin: *
This applies the Access-Control-Allow-Origin header to any incoming URL.
Hey! Sorry for the delay (topic was hidden temporarily) and thank you for the response.
I tried as you suggested but I didn’t work, it seems it broke the _headers file, as it continued to send the Access-Control-Allow-Origin header and stopped sending the other headers. Maybe I did something wrong in the process
What I done for now was create a Transform Rule on the dashboard to remove the header, but ideally the header shouldn’t be sent at all.
I don’t know if I did something wrong while trying to remove the Access-Control-Allow-Origin header or if Cloudflare changed something in their end since this topic, but it seems prepending the header directive with ! to remove a header is now working as intended.
I also noticed there’s now a “Detach a header” section in the docs.