Use Zaraz on domains not proxied by Clou...

Hi, I'm trying to setup zaraz on a non-proxied domain. I used the steps at https://developers.cloudflare.com/zaraz/advanced/domains-not-proxied/ However, I'm running into the following console error when doing so - Access to script at 'https://z.example.net/cdn-cgi/zaraz/i.js' from origin 'https://example.net' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header has a value 'https://z.example.net' that is not equal to the supplied origin.
Cloudflare Docs
Use Zaraz on domains not proxied by Cloudflare · Cloudflare Zaraz d...
You can load Zaraz on domains that are not proxied through Cloudflare. However, you will need to create a separate domain, or subdomain, proxied by …
10 Replies
zilch
zilchOP5mo ago
I've replaced my actual website name with "example" any idea how to get the setup working? example.net is the website where i'm trying to set zaraz up this way, it's proxied by cloudflare for now, but i want to disable the proxy z.example.net is a subdomain pointing to the same cf pages deployment as example.net, this one is proxied
Unknown User
Unknown User5mo ago
Message Not Public
Sign In & Join Server To View
JAKEN 👻
JAKEN 👻5mo ago
@zilch What I did was set a custom domain zaraz.example.com and pointed it to 'https://zaraz.example.net/cdn-cgi/zaraz/i.js this got around the CORS issues I had. otherwise you need to check your CSP and make sure your domain is allowing access to the script.
zilch
zilchOP5mo ago
where can i check that? sorry i'm not familiar with CSP/CORS
JAKEN 👻
JAKEN 👻5mo ago
Depends on what your server is set up as. Are you running apache or nginx? Also what stack is the site built on
zilch
zilchOP5mo ago
The website is a cf pages deployment I've set the domain using cloudflare dns and as a custom domain for the cf pages deployment however, i don't want to use the cf proxy for the domain, since it doesn't have good routing in india, so i wish to turn off the orange cloud. However, that means i have to give up zaraz, unless I get this above mentioned setup working @yo'av any reason zaraz is setup under /cdn-cgi ? can it not be setup like https://static.cloudflareinsights.com/beacon.min.js for web analytics?
JAKEN 👻
JAKEN 👻5mo ago
@zilch have a look at this quick article and let me know if it points you in the right direction https://developers.cloudflare.com/pages/functions/examples/cors-headers/
Cloudflare Docs
Adding CORS headers · Cloudflare Pages docs
This example is a snippet from our Cloudflare Pages Template repo.
zilch
zilchOP5mo ago
Thanks for the help, I managed to resolve cors with the help of a transform rule - https://stackoverflow.com/questions/76983353/how-to-configure-cors-of-access-control-allow-origin-using-cloudflare
Stack Overflow
How to configure CORS of "Access-Control-Allow-Origin" Using Cloudf...
I am having this error when submitting file: Access to XMLHttpRequest at 'https://dd-demo.abc.com:8443/api/token' from origin 'https://dd-demo.abc.com' has been blocked by CORS policy: Response to
sumit
sumit5mo ago
commenting to follow this thread
JAKEN 👻
JAKEN 👻5mo ago
@cooper | Meme Dev ☁ do you happen to need assistance here?
Want results from more Discord servers?
Add your server