Good morning all.
Here’s the situation: I’m attempting to move all my rails sites from a VPS to Heroku.
My first site is going quite well.
Yea there’s been some growing pains to deal with but I’m learning.
I’m hung up on one thing.
“bad URI or cross-site access not allowed source”
My Font Awesome and I think some Twitter Bootstrap assets are not being found or something about CORS (Cross Origin Resource Sharing) is holding me up.
This link: http://cookieshq.co.uk/posts/how-to-get-more-value-out-of-your-heroku-dynos-and-speed-up-your-rails-application/ was a great help and it pointed me to the rack-cors gem but I haven’t solved this yet.
The production site is www.hobokenbodyart.com.
Thanks for any light you can shed on this.
I’ve encountered a similar problem trying to serve fonts in the Rails asset pipeline via CloudFront (which I think you’re doing, based on the linked article).
IIRC, Rails does not set CORS headers for font files, so fonts served from a CDN are not correctly loaded by some browsers because the requesting host (your domain) is different from the asset host (the CDN).
I resolved this by using the font_assets gem to set the correct
Access-Control-Allow-Origin header for font files served from a CDN.
The gem’s README is pretty thorough, but you’ll likely need to configure (in
config.font_assets.origin = "http://www.hobokenbodyart.com"
It’s worth a shot.
So that rack-cors gem is probably useless in this case?
I’ll post back after testing.
Thanks for the reply.
After weighing the cost of my VPS vs. Heroku, I decided to revert back to my VPS.
Seeing that Heroku has changed the free dyno package so that they sleep for 6 hours, I really thought hard about it and couldn’t accept not reaching users for 6 hours out of the day when with my VPS, it’s always online.
And $7 per site is just too much when I can serve as many sites as I want for $20 per month.
It was a fun 4 day adventure, changing code and learning more about how to get Heroku to work with AWS (CloudFront and S3)
All in all it was a great learning experience.
Thank God for ‘git reset --hard’