What is the name of the domain?
.com
What is the issue you’re encountering
Cloudflare is injecting JavaScript into XML feed
What are the steps to reproduce the issue?
Hello Cloudflare community,
I have been using Cloudflare for my online store for several years, and until recently everything was working correctly.
My website is an e-commerce store, and I use two PrestaShop modules to export my products to external platforms:
- Google Merchant Center feed module
- Facebook Dynamic Ads / Catalog feed module
These modules generate XML product feeds that are used by Google Merchant and Facebook Catalog to synchronize my products.
A few days ago, both Google Merchant and Facebook started showing an authentication problem when trying to access the XML feed:
- Unauthorized error
- Username/password required
After investigation, I created Cloudflare Custom Rules to allow access to these feed URLs:
Google feed:
/module/gmerchantcenterpro/fly
Facebook feed:
/module/facebookproductad/fly
The authentication problem was solved after creating the Skip rules, and Google/Facebook could access the feeds again.
However, a new problem appeared.
Now Google Merchant and Facebook reject the XML files because the XML response is modified and contains additional content that should not be there.
At the end of the XML file, after the closing tag:
</rss>
I can see Cloudflare-injected code:
</rss><script>(function(){function c(){var b=a.contentDocument||(a.contentWindow&&a.contentWindow.document);if(b){var d=b.createElement('script');d.innerHTML="window.__CF$cv$params={...}";var a=document.createElement('script');a.src='/cdn-cgi/challenge-platform/scripts/jsd/main.js';document.getElementsByTagName('head')[0].appendChild(a);</script>
This makes the XML feed invalid for Google Merchant and Facebook Catalog.
Facebook also reports:
Data file failed to upload
An XML declaration was found on line 1 column 2 but it must appear at the very start of the document. Please move the XML declaration to the first line of the file.
I would like to understand which Cloudflare feature or setting is injecting this script into the XML response.
Things I already tested:
- Disabled Bot Fight Mode temporarily
- Disabled JS detections
- Disabled RUM / Web Analytics injection
- Checked Browser Integrity Check
- Created Skip rules for the feed URLs
- Allowed the feed paths through Cloudflare security rules
Despite these tests, the extra Cloudflare script is still added to the XML output.
Could someone please help me identify:
- Which Cloudflare feature adds
/cdn-cgi/challenge-platform/scripts/jsd/main.jsor the Cloudflare beacon script into responses? - Which setting should be disabled or modified to prevent any JavaScript injection into XML feeds?
- Is there a recommended Cloudflare configuration for XML product feeds used by Google Merchant Center and Facebook Catalog?
My goal is simply to keep the XML feed generated by the modules completely unchanged, for example:
<?xml version="1.0" encoding="UTF-8"?>
<rss>
...
</rss>
without any additional scripts before or after the XML content.
Thank you very much for your help and guidance.
Best regards,