Piwik not working on CDN / Cloudfront

I just set up a new piwik install.
I use cloufront on this server, so I changed the tracking code

from this:
var u=((“https:” == document.location.protocol) ? “https” : “http”) + “://mydomain.com/piwik/”;


var u=((“https:” == document.location.protocol) ? “https” : “http”) + “://xyz.cloudfront_url/piwik/”;

When I did this, no tracking details were sent. Assoon as I replaced with the original, it started transmitting data.

the cloudfront url was fine. I tested it: i.e going to xyz.cloudfront_url/piwik sent me to the piwik screen just like with mydomain.com/piwik/

any idea why this is happening? Thanks for your help

Sorry, I found a work around in the forums. I searched for CDN but earlier did not find any hits :frowning:
This is the link that had the fix

Is this the most efficient fix?


This link no longer works