문제

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.

도움이 되었습니까?

해결책 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.

다른 팁

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
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top