Get 404 When Using CloudFront URL

0

We are using CloudFront with a custom origin. No matter what file we try to access on the CloudFront, we get a 404. For example,

http://d3v86xu0ubcgl3.cloudfront.net/hg/files1/kirkseyarchitecture/00/00a7da2b-15c8-49c6-a831-e17e6828a5f9.jpg

Even if we go to the root of the site at http://d3v86xu0ubcgl3.cloudfront.net/ we get a 404.

When the origin server is accessed, the file comes up:

http://www.kirksey.hexagroup.us/hg/files1/kirkseyarchitecture/00/00a7da2b-15c8-49c6-a831-e17e6828a5f9.jpg

Does anyone have any ideas on what the issue could be?

asked 7 years ago6514 views
2 Answers
0

Examining the response headers from the error it's clear that the error response is actually being generated by your origin server. A better understanding of the reason for the error should be obtainable by reviewing the origin server's logs. There should be something there that differs from what you assume will be there.

Common causes:

▶ You've misunderstood the purpose of the "Origin Path" setting. This value should usually be left blank. If populated, its value is prepended to the path of each request from the browser, before the request is forwarded to the origin.

http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-web-values-specify.html#DownloadDistValuesOriginPath

▶ Your origin server is not expecting the incoming HTTP Host header that's being sent by CloudFront with each request, and assumes the request is for an unknown/unconfigured site. Specifically, there are two choices for what CloudFront sends to the origin server as the Host header.

If you don't configure a Cache Behavior to whitelist the Host header, CloudFront sends the hostname you configured for Origin Domain Name.

If you do configure a Cache Behavior to whitelist the Host header (or to forward all headers), CloudFront sends the same Host header that was sent into CloudFront by the browser -- the same hostname shown in the browser's address bar -- which would be the distribution hostname dxyzzyexample.cloudfront.net in this case, or would be an Alternate Domain Name you've configured on the distribution, if that's the hostname the browser is actually using to make the request in question.

sqlb0t
answered 7 years ago
0

Hi,
The point has already been pointed out in the earlier response. The origin of this distribution is [www.kirksey.hexagroup.us], but you have mentioned an "origin path" as well. This means when you access http://d3v86xu0ubcgl3.cloudfront.net/page1.html, the following address will be fetched fetched from origin:
http://www.kirksey.hexagroup.us/s3/kirksey-website/page1.html

How to fix it:
1- Please go to the CloudFront console
2- Select your distribution
3- Go to the "origin" tab
4- Edit the origin
5- Remove the "Origin Path"
6- Save

AWS
answered 7 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions