cjk77 is experiencing a CORS error when trying to load a custom font in a Discourse theme component. Despite adding the Cloudfront URL to the CORS setting, the error persists.
Troubleshooting Steps
Arkshine suggested checking if DISCOURSE_ENABLE_CORS is set in the app.yml file.
cjk77 confirmed with the hosting provider that DISCOURSE_ENABLE_CORS is set to TRUE, but the issue remains.
Johani suspects that the DISCOURSE_ENABLE_CORS setting is not the solution, as it allows requests from added domains to access the Discourse domain, not the other way around.
Johani suggests that the CDN might be blocking requests from the Discourse domain and recommends using a curl command to test the response headers.
Potential Solution
Johani believes that the CDN needs to be configured to allow requests from the Discourse domain, and the presence of Access-Control-Allow-Origin: * in the response headers would indicate a successful setup.
I just tried this, just like you described, on a site with a CDN setup and it worked. So, I think this might be limited to your site.
I think the DISCOURSE_ENABLE_CORS setting is the inverse of what you want. Adding domains to that setting will allow requests from those domains access to your Discourse domain, not the other way around.
What you want is to allow requests from your Discourse domain to get access to the file on your CDN. I think your CDN is blocking those requests. You can confirm that by running something like this in a terminal window, after you change the values of course.