1

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.

I've done a fair bit of googling around for solutions and have implemented suggestions from the following...

Cloudfront custom-origin distribution returns 502 "ERROR The request could not be satisfied." for some URLs

But still with no luck in resolving 502 errors. I've double checked my ssl cert and it is valid.

Below are my nginx ssl config and sample request / response

Our current ssl settings in nginx

nginx 1.6.1

ssl_protocols TLSv1 TLSv1.1 TLSv1.2;

ssl_prefer_server_ciphers on;

ssl_ciphers ECDH+AESGCM:ECDH+AES256:ECDH+AES128:DH+3DES:RSA+3DES:RC4:HIGH:!ADH:!AECDH:!MD5;

Sample request / response

Request

GET /assets/javascripts/libs/lightbox/2.7.1/css/lightbox.css?v=20141017003139 HTTP/1.1

Host: d2isui0svzvtem.cloudfront.net

Connection: keep-alive

Pragma: no-cache

Cache-Control: no-cache

Accept: text/css,/;q=0.1

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

Accept-Encoding: gzip,deflate,sdch

Accept-Language: en-US,en;q=0.8

Response

HTTP/1.1 502 Bad Gateway

Content-Type: text/html

Content-Length: 472

Connection: keep-alive

Server: CloudFront

Date: Fri, 17 Oct 2014 00:43:17 GMT

X-Cache: Error from cloudfront

Via: 1.1 f25f60d7eb31f20a86f3511c23f2678c.cloudfront.net (CloudFront)

X-Amz-Cf-Id: lBd3b9sAJvcELTpgSeZPRW7X6VM749SEVIRZ5nZuSJ6ljjhkmuAlng==

Trying the following yields the same result...

wget https://d2isui0svzvtem.cloudfront.net/assets/javascripts/libs/lightbox/2.7.1/css/lightbox.css

Any ideas on what is going on here?

Thanks in advance.

Community
  • 1
  • 1
ruski77
  • 19
  • 1
  • 3

2 Answers2

0

Set "Compress Objects Automatically" to no.

Hans Rossel
  • 211
  • 2
  • 6
-2

make sure Origin Settings->Origin Protocol Policy is set to "HTTPS Only"

vedat
  • 1,193
  • 9
  • 10