Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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:!/cp0wwy/

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

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

Your CDN URLs are returning 301 Redirects.

curl -I

HTTP/1.1 301 Moved Permanently
Content-Type: text/html
Content-Length: 186
Connection: keep-alive
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 (CloudFront)
X-Amz-Cf-Id: dcbTEOwj48JfPD8YrvKrk4m2-OCkCAAABdqnwGxBOfRkmdLLpl7ErQ==

I'd bet you pointed your CloudFront distribution at rather than 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


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.