Question

I'm using cloudfront as my CDN in my Rails app. I created my distribution and changed the enviroment file to enable the asset host.

Everything was working fine until I made a new deploy that included 3 new images. After restarting, everything looks fine but the 3 images. If I get the cloudfront URL and change the domain for my rails app domain the images load just fine, but if I use the CloudFront domain the images look like they weren't found.

Any ideas why this is happening? If I undestand correctly CloudFront doesn't have a delay, it loads the image as soon as the first request comes in.

Was it helpful?

Solution 2

I found the problem. Sometime between the precompile and the restart of the server someone made a request and Cloudfront couldn't find the image so that's why it wasn't showing. I changed the image name, re-depoyed it and everything is fine now.

OTHER TIPS

run rake assets:precompile then upload it.

or check the image path it should begin with "/" like

<img src="/images/img.jpg"/> if you are images in public assets
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top