0
votes

I am trying to serve all assets through cloudfront on my Rails 4.2 app hosting on Heroku. I have been successful using cloudfront before using heroku apps that have somename.herokuapp.com, but this one has a custom domain and a wildcard SSL. I cannot get any of the assets to serve, they all have 403

I have tried uploading my SSL on AWS & also tried using the Default CloudFront Certificate (*.cloudfront.net) (which works for my non-custom domain apps).

I have made sure my SSL is in the region on AWS that AWS wants it to be (N.Virginia).

I have made sure I'm only using HTTP/1.1, HTTP/1.0.

I have made sure my distribution is 'enabled'.

My SSL is a wildcard so it looks like this '*.mydomain.com'

When I uploaded it to AWS and added it to my distribution, I see that it is in use.

I have made sure that my aws_id/aws_key are valid. However, there is some sort of Cloudfront key/pair, but I don't know where I would put that on my site, I only have ENV variables for aws_id/aws_secret_key.

Request URL:https://mycloudfrontdistn.cloudfront.net/assets/subfolder/secondfolder/gift-52db27eb2ced10800db38fbd74ec2ef40704d8c55d49b2654f7fe014e4bd1eff.png
Request Method:GET
Status Code:403 Forbidden
Remote Address:REDACTED (I don't know if this is sensitive)
Response Headers
view source
Connection:keep-alive
Content-Length:146
Content-Type:text/xml
Date:Fri, 04 Nov 2016 23:06:47 GMT
Server:CloudFront
Via:1.1 somebignumber.cloudfront.net (CloudFront)
X-Amz-Cf-Id:myAmazonKey==
X-Cache:Error from cloudfront

Request Headers
view source
Accept:image/webp,image/*,*/*;q=0.8
Accept-Encoding:gzip, deflate, sdch, br
Accept-Language:en-US,en;q=0.8
Cache-Control:max-age=0
Connection:keep-alive
Host:mycloudfrontdist.cloudfront.net
Referer:https: https//www.mysite.com
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36
1

1 Answers

0
votes

This error occurs if you enable Restrict Viewer Access on the cache behavior on the distribution, but you are not actually using CloudFront signed URLs because the content is public.

If you want requests for objects that match the PathPattern for this cache behavior to use public URLs, choose No.