Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Here is an example: http://tools.pingdom.com/fpt/#!/cp0wwy/http://www.shearcomfort.com/Car-Seat-Covers_CDN.asp

Pick any image, say 2014_subaru_outback_mini.jpg then you can see it appears twice: once from cloudfront with 0 bytes and the second time from the actual domain shearcomfort.com

Can anyone explain what is going on here and how to make all the assets come only from cloudfront and not from the home domain?

share|improve this question
up vote 1 down vote accepted
+50

Your CDN URLs are returning 301 Redirects.

curl -I http://d3cerlni7xmxaw.cloudfront.net/images/stars/images/2starrating.gif

HTTP/1.1 301 Moved Permanently
Content-Type: text/html
Content-Length: 186
Connection: keep-alive
Location: http://www.shearcomfort.com/images/stars/images/2starrating.gif
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
Date: Tue, 20 May 2014 17:43:02 GMT
X-Cache: Miss from cloudfront
Via: 1.1 45f9deebd67d2bd40b8384feda6e6e32.cloudfront.net (CloudFront)
X-Amz-Cf-Id: dcbTEOwj48JfPD8YrvKrk4m2-OCkCAAABdqnwGxBOfRkmdLLpl7ErQ==

I'd bet you pointed your CloudFront distribution at shearcomfort.com rather than www.shearcomfort.com. You appear to 301 URLs on that domain to the www version.

share|improve this answer

The 301 Moved Permanently can also happen if you're running a https only site and 301 redirect http visitors to https (and therefore also cloudfront).

There is a setting under origin in cloudfront "Origin Protocol Policy" make sure this is set to "Match Viewer" so that cloudfront requests the https version from your origin server and not http (as is default).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.