Heroku CDN CloudFront Font – Firefox Error

Recently, we transferred our assets to CDN Cloudfront. We noticed that the surface on Firefox was broken. After a few minutes of searching, this is a CORS story. We allowed the use of Cloudfront Field.

application_controller:

after_filter :set_access_control_headers

def set_access_control_headers
headers['Access- Control-Allow-Origin'] = CDN_CLOUDFRONT
end

production.rb:

CDN_CLOUDFRONT = "http://xxx.cloudfront. net"

This has been going well until yesterday. After several searches and reflections, I haven’t found a solution yet.

Any ideas?

I did not use Heroku settings, but AFAIK (and as shown on developer.mozilla.org), The title Access-Control-Allow-Origin should reflect the value of the domain that consumes static assets from the CDN.

For example.:
For hosting at http://mydomain.net and from http: //wefe342r34r23.cloudfront.net website for consuming assets

headers [‘Access-Control-Allow-Origin’] =’http://mydomain.net’

Allow mydomain. Net access assets through http://wefe342r34r23.cloudfront.net. In other words, replacing CDN_CLOUDFRONT with your website’s domain name can solve the problem.

I hope this helps.

PS: Until yesterday I was not sure how your settings work.

PPS: Adding alternate domain names (CNAME) to your CDN will help you quickly discard it in http://xxx.cloudfront.net Make the existing distribution public and start using the new distribution http://yyy.cloudfront.net. You do not need to change anything in the application code base if you are using an alternate domain name, such as http://cdn.mydomain. net.

Recently, we transferred assets to CDN Cloudfront. We noticed that the surface on Firefox was broken. After a few minutes of searching, it was a CORS Story. We allow the use of Cloudfront fields.

application_controller:

after_filter :set_access_control_headers

def set_access_control_headers
headers['Access-Control-Allow-Origin'] = CDN_CLOUDFRONT
end

production.rb:

CDN_CLOUDFRONT = "http://xxx.cloudfront.net"

This went smoothly until yesterday. After several searches and reflections, I haven’t found a solution yet.

Any ideas?

I did not use Heroku settings, but AFAIK (and as shown on developer.mozilla.org), the title Access-Control-Allow-Origin should reflect from CDN The value of the domain that consumes static assets.

For example.:
For websites that are hosted at http://mydomain.net and consume assets from http://wefe342r34r23.cloudfront.net< /p>

headers [‘Access-Control-Allow-Origin’] =’http://mydomain.net’

Allow mydomain.net to access through http://wefe342r34r23.cloudfront.net Assets. In other words, replacing CDN_CLOUDFRONT with your website’s domain name can solve the problem.

Hope this helps.

PS: Until yesterday I was not sure how your settings work .

PPS: Adding an alternate domain name (CNAME) to your CDN will help you quickly discard the existing distribution publicly available at http://xxx.cloudfront.net and start using the new distribution http: //The case of yyy.cloudfront.net. You don’t need to change anything in the application code base if you are using an alternate domain name, such as http://cdn.mydomain.net.

Leave a Comment

Your email address will not be published.