sparkle
sparkle

Reputation: 7398

Cross-Origin Resource Sharing policy: No 'Access-Control-Allow-Origin' and Rackspace

It been working for months, but today it stops working. I've installed these gems, but it's not working

gem 'rails', '4.0.3'
gem 'font_assets'
gem 'rack-cors', :require => 'rack/cors'

Font from origin 'http://6af24a42fabfb14d7f00-ef9264e9169f87a8b11474767c5edeab.r39.cf3.rackcdn.com' has been blocked from loading by Cross-Origin Resource Sharing policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://mywebsite.domain.com' is therefore not allowed access.

Upvotes: 1

Views: 1850

Answers (1)

Pramod Solanky
Pramod Solanky

Reputation: 1700

With respect to the above comment of mine, I'm copying some important things that will help you set headers on your assets from the cdn.

Cross-Origin Resource Sharing (CORS) is a mechanism that allows code running in a browser to make requests to a domain other than the one from which it originated. CORS container headers enable your users to upload files from one website, or origin, to your Cloud Files account. When you set the CORS headers on your container, you provide Cloud Files with the following information:

Which sites can post to your account

How often your container checks its allowed sites list

What headers to expose to the browser in the request response

[Note] Note You use CORS with the following features:

FormPost (Section 13.2: “FormPost”), to enable your users to post to your site

TempURL (Section 13.1: “TempURL ”), to limit how long users can use a given URL

Cloud Files supports CORS requests to containers and objects. CORS metadata is held on the container only. The values given apply to the container itself and all objects within it.

The following table lists the supported container headers.

enter image description here

So the idea is to set the header on a container that will set the header on all the objects found in the container Hope it helps

Upvotes: 1

Related Questions