title: Cloudfront returning 502 errors
body: <p>We're in the process of moving our server environments to aws from another cloud hosting provider. We have previously been using Cloudfront to serve up our static content, when attempting to retrieve static content from Cloudfront in our new aws setup, we're getting 502 bad gateway errors.</p>
  
  <p>I've done a fair bit of googling around for solutions and have implemented suggestions from the following...</p>
  
  <p><a href="https://stackoverflow.com/questions/20664018/cloudfront-custom-origin-distribution-returns-502-error-the-request-could-not-b">Cloudfront custom-origin distribution returns 502 &quot;ERROR The request could not be satisfied.&quot; for some URLs</a></p>
  
  <p>But still with no luck in resolving 502 errors. I've double checked my ssl cert and it is valid. </p>
  
  <p>Below are my nginx ssl config and sample request / response</p>
  
  <p><strong>Our current ssl settings in nginx</strong>  </p>
  
  <p>nginx 1.6.1</p>
  
  <p>ssl_protocols TLSv1 TLSv1.1 TLSv1.2;</p>
  
  <p>ssl_prefer_server_ciphers on;</p>
  
  <p>ssl_ciphers ECDH+AESGCM:ECDH+AES256:ECDH+AES128:DH+3DES:RSA+3DES:RC4:HIGH:!ADH:!AECDH:!MD5;</p>
  
  <p><strong>Sample request / response</strong></p>
  
  <p><strong>Request</strong></p>
  
  <p>GET /assets/javascripts/libs/lightbox/2.7.1/css/lightbox.css?v=20141017003139 HTTP/1.1</p>
  
  <p>Host: d2isui0svzvtem.cloudfront.net</p>
  
  <p>Connection: keep-alive</p>
  
  <p>Pragma: no-cache</p>
  
  <p>Cache-Control: no-cache</p>
  
  <p>Accept: text/css,<em>/</em>;q=0.1</p>
  
  <p>User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.104 Safari/537.36</p>
  
  <p>Accept-Encoding: gzip,deflate,sdch</p>
  
  <p>Accept-Language: en-US,en;q=0.8</p>
  
  <p><strong>Response</strong></p>
  
  <p>HTTP/1.1 502 Bad Gateway</p>
  
  <p>Content-Type: text/html</p>
  
  <p>Content-Length: 472</p>
  
  <p>Connection: keep-alive</p>
  
  <p>Server: CloudFront</p>
  
  <p>Date: Fri, 17 Oct 2014 00:43:17 GMT</p>
  
  <p>X-Cache: Error from cloudfront</p>
  
  <p>Via: 1.1 f25f60d7eb31f20a86f3511c23f2678c.cloudfront.net (CloudFront)</p>
  
  <p>X-Amz-Cf-Id: lBd3b9sAJvcELTpgSeZPRW7X6VM749SEVIRZ5nZuSJ6ljjhkmuAlng==</p>
  
  <p>Trying the following yields the same result...</p>
  
  <p>wget <a href="https://d2isui0svzvtem.cloudfront.net/assets/javascripts/libs/lightbox/2.7.1/css/lightbox.css" rel="nofollow noreferrer">https://d2isui0svzvtem.cloudfront.net/assets/javascripts/libs/lightbox/2.7.1/css/lightbox.css</a></p>
  
  <p>Any ideas on what is going on here?</p>
  
  <p>Thanks in advance.</p>