I have 2 CloudFront distributions
One (cdn.civicxclub.com) pointing to the S3 buckets for serving the uploaded images directly from the CDN. THIS WORKS.
The other one (civicxclub.com) pointing to the balancer, in order to serve the app and all the static files from it. THIS DOESN’T WORK
This is the behaviours configuration that I have:
The default one has Cache Based on Selected Request Headers option set to All in order to not allow caching from the backend.
All the others has Cache Based on Selected Request Headers set to *Whitelist and I whitelist Host, Origin and Referer headers.
When I access the web from the browser and inspect headers from for example an avatar It always says Miss from cloudfront, but when I access the file twice directly from the brownser, it says Hit from cloudfront, so the caching is working, but not when loading files from the forum web page.
How can I then serve avatars, css and js files from this CDN if they are stored on the server??
I’ve tried to use the cdn.civicxclub.com url which is mapping to the S3 bucket and add all the behaviours related to discourse static content, and it failed.