title: MISS from Cloudfront after HIT from Cloudfront
body: <p>I am switching to Amazon Cloudfront for serving images on my website. To reduce load when we finally make it live, I thought of warming up the cache by hitting image URLs (I am making these request from India and expect majority of users to request from the same region so no need to have a copy of object on all edge locations worldwide).</p>
  
  <p>The problem is that script uses curl to request image and when I access the same URL in browser I get MISS from Cloudfront. So Cloudfront is making two copies of object for these two request.</p>
  
  <p>My current Cloudfront configuration forwards Content-Type request Header to origin.</p>
  
  <p>How should I configure Cloudfront so that it doesn't care about request headers at all and once I made a request (whether curl or using browser) it should serve all future request for same resource from edge and not origin.</p>
  
  <p>Request/Response headers-
  I am afraid that the Cloudfront url won't be accessible from outside (until we go live) but I am posting request/response headers, this should give you fair idea. Also you can check out caching headers at origin - <a href="https://origin.ixigo.com/image/upload/t_thumb,f_auto/r7y6ykuajvlumkp4lk2a.jpg" rel="nofollow">https://origin.ixigo.com/image/upload/t_thumb,f_auto/r7y6ykuajvlumkp4lk2a.jpg</a></p>
  
  <p><strong>Response after two successive request using browser</strong><br>
  Remote Address:54.230.156.66:443<br>
  Request URL:<a href="https://youcannotaccess.com/image/upload/t_thumb,f_auto/r7y6ykuajvlumkp4lk2a.jpg" rel="nofollow">https://youcannotaccess.com/image/upload/t_thumb,f_auto/r7y6ykuajvlumkp4lk2a.jpg</a><br>
  Request Method:GET<br>
  Status Code:200 OK<br>
  Response Headers<br>
  view source<br>
  Accept-Ranges:bytes<br>
  Age:23<br>
  Cache-Control:public, max-age=31557600<br>
  Connection:keep-alive<br>
  Content-Length:8708<br>
  Content-Type:image/jpg<br>
  Date:Fri, 27 Nov 2015 09:16:03 GMT<br>
  ETag:"-170562206"<br>
  Last-Modified:Sun, 29 Jun 2014 03:44:59 GMT<br>
  Vary:Accept-Encoding<br>
  Via:1.1 7968275877e438c758292828c0593684.cloudfront.net (CloudFront)<br>
  X-Amz-Cf-Id:fcbGLv8uBOP89qfR52OWa-NlqWkEREJPpZpy9ix0jdq8-a4oTx7lNw==<br>
  X-Backend:image6_40<br>
  X-Cache:Hit from cloudfront<br>
  X-Cache-Hits:0<br>
  X-Device:pc<br>
  X-DeviceType:pc<br>
  X-Powered-By:xyz  </p>
  
  <p><strong>Now same url requested using curl but gave me miss</strong><br>
  curl manu-mdc:cache manuc$ curl -I <a href="https://youcannotaccess.com/image/upload/t_thumb,f_auto/r7y6ykuajvlumkp4lk2a.jpg" rel="nofollow">https://youcannotaccess.com/image/upload/t_thumb,f_auto/r7y6ykuajvlumkp4lk2a.jpg</a><br>
  HTTP/1.1 200 OK<br>
  Content-Type: image/jpg<br>
  Content-Length: 8708<br>
  Connection: keep-alive<br>
  Age: 0<br>
  Cache-Control: public, max-age=31557600<br>
  Date: Fri, 27 Nov 2015 09:16:47 GMT<br>
  ETag: "-170562206"<br>
  Last-Modified: Sun, 29 Jun 2014 03:44:59 GMT<br>
  X-Backend: image6_40<br>
  X-Cache-Hits: 0<br>
  X-Device: pc<br>
  X-DeviceType: pc<br>
  X-Powered-By: xyz<br>
  Vary: Accept-Encoding<br>
  X-Cache: Miss from cloudfront<br>
  Via: 1.1 4d42171c56a4c8b5c627040e6aa0938d.cloudfront.net (CloudFront)<br>
  X-Amz-Cf-Id: fY0LXhp7NlqB-I8F5-1TIMnA6bONjPD3CEp7dsyVdykP-7N2mbffvw==  </p>
  
  <p><strong>Now this will give HIT</strong><br>
  manu-mdc:cache manuc$ curl -I <a href="https://youcannotaccess.com/image/upload/t_thumb,f_auto/r7y6ykuajvlumkp4lk2a.jpg" rel="nofollow">https://youcannotaccess.com/image/upload/t_thumb,f_auto/r7y6ykuajvlumkp4lk2a.jpg</a><br>
  HTTP/1.1 200 OK<br>
  Content-Type: image/jpg<br>
  Content-Length: 8708<br>
  Connection: keep-alive<br>
  Cache-Control: public, max-age=31557600<br>
  Date: Fri, 27 Nov 2015 09:16:47 GMT<br>
  ETag: "-170562206"<br>
  Last-Modified: Sun, 29 Jun 2014 03:44:59 GMT<br>
  X-Backend: image6_40<br>
  X-Cache-Hits: 0<br>
  X-Device: pc<br>
  X-DeviceType: pc<br>
  X-Powered-By: xyz<br>
  Age: 3<br>
  Vary: Accept-Encoding<br>
  X-Cache: Hit from cloudfront<br>
  Via: 1.1 6877899d48ba844a34ea4378ce336f06.cloudfront.net (CloudFront)<br>
  X-Amz-Cf-Id: qpPhbLX_5t2Xj0XZuZdjWD2w-BI80DUVyL496meQkLfSEn3ikt7hNg==  </p>