Sunteți pe pagina 1din 10

10/24/2017 AWS Developer Forums: Cloudfront domain redirects to S3 ...

Amazon Web Services Sign Up My Account / Console English

AWS Products & Solutions AWS Product Information Developers Support

Discussion Forums Welcome Logout Forums Help

Discussion Forums > Category: Storage & Content Delivery > Forum: Amazon CloudFront >Thread: Cloudfront domain redirects to S3 Origin URL

Search Forum : Advanced search options

Cloudfront domain redirects to S3 Origin URL Reply Available Actions


Posted by: ratheesahab Reply to this Thread

Posted on: Sep 27, 2015 8:24 AM

cloudfront , s3
Icon Legend
Answered question
This question is not answered. Answer it to earn points.
Unanswered question with
answer points still available
I've configured a CloudFront distribution to Amazon S3. Unanswered question

AWS Forums Status Icons


My CloudFront Domain is : d2pgt27y8augeg.cloudfront.net
Ace: 2000+ pts
And S3 bucket name is : datascraping
So the Origin is : datascraping.s3.amazonaws.com Expert: 750-1999 pts

Guide: 300-749 pts


But when i visit the CloudFront domain it redirect from http://d2pgt27y8augeg.cloudfront.net/index.htm
Enthusiast: 50-299 pts
TO
Newbie: 5-49 pts
http://datascraping.s3-ap-southeast-1.amazonaws.com/index.htm
Amazonian
How can i stop this redirection and serve the content using cloudfront only?

Edited by: ratheesahab on Sep 27, 2015 8:24 AM

Replies: 18 | Pages: 1 - Last Post: Oct 21, 2017 4:35 PM by: alz70

R li
https://forums.aws.amazon.com/thread.jspa?threadID=216814 1/10
10/24/2017 AWS Developer Forums: Cloudfront domain redirects to S3 ...
Replies

Re: Cloudfront domain redirects to S3 Origin URL Reply

Posted by: Mohsin@AWS

Posted on: Sep 28, 2015 9:18 AM

in response to: ratheesahab

Hello,

I have engaged the team with regards to the temporary redirect you are experiencing. I will provide you an update
once more information becomes available.

Regards,
Mohsin

Re: Cloudfront domain redirects to S3 Origin URL Reply

Posted by: Pierre Freund

Posted on: Sep 28, 2015 10:44 AM

in response to: Mohsin@AWS

Hello,

I'm experiencing the same problem on d2uqbhp6y2duzk.cloudfront.net.


It should not redirect to the S3 origin. I have the same configuration for another distribution
(dciabuntbkvst.cloudfront.net) and I don't have the problem.

Any idea ?

Re: Cloudfront domain redirects to S3 Origin URL Reply

Posted by: Mohsin@AWS

Posted on: Sep 28, 2015 12:10 PM

in response to: Pierre Freund

Hello,

Just as a general FYI,


https://forums.aws.amazon.com/thread.jspa?threadID=216814 2/10
10/24/2017 AWS Developer Forums: Cloudfront domain redirects to S3 ...
g ,

Per our AWS documentation (http://docs.aws.amazon.com/AmazonS3/latest/dev/Redirects.html), Due to the


distributed nature of Amazon S3, requests can be temporarily routed to the wrong facility. This is most likely to
occur immediately after buckets are created or deleted. For example, if you create a new bucket and immediately
make a request to the bucket, you might receive a temporary redirect, depending on the location constraint of the
bucket. If you created the bucket in the US Standard region (s3.amazonaws.com endpoint) you will not see the
redirect because this is also the default endpoint. However, if bucket is created in any other region, any requests for
the bucket will go to the default endpoint while the bucket's DNS entry is propagated. The default endpoint will
redirect the request to the correct endpoint with a HTTP 302 response.

Temporary redirects contain a URI to the correct facility which you can use to immediately resend the request.

Is this a newly created S3 bucket you have created?

Regards,
Mohsin

Re: Cloudfront domain redirects to S3 Origin URL Reply

Posted by: pfreund2

Posted on: Sep 28, 2015 2:03 PM

in response to: Mohsin@AWS

Yes I created the bucket and immediately after cloudfront distribution.

If I delete and create another distribution, I still have the problem.


I can delete and create again everything, how can I do to be sure it works ? Do I have to wait between Bucket and
Distribution creation ?

Re: Cloudfront domain redirects to S3 Origin URL Reply

Posted by: ratheesahab

Posted on: Sep 28, 2015 7:18 PM

in response to: Mohsin@AWS

It's been 3 days i've created this bucket in singapore region, but redirect is still happening?

Re: Cloudfront domain redirects to S3 Origin URL Reply

https://forums.aws.amazon.com/thread.jspa?threadID=216814 3/10
10/24/2017 AWS Developer Forums: Cloudfront domain redirects to S3 ...

Posted by: Jil@AWS

Posted on: Sep 29, 2015 1:10 AM

in response to: ratheesahab

Hello,

Could you please let us know if you are still facing the issue?

I've tried to request the URL:

1st attempt (Miss from CloudFront)

$ curl -I http://d2pgt27y8augeg.cloudfront.net/index.htm

HTTP/1.1 200 OK
Content-Type: text/html
Content-Length: 26987
Connection: keep-alive
Date: Tue, 29 Sep 2015 08:05:02 GMT
Last-Modified: Sun, 27 Sep 2015 14:37:44 GMT
ETag: "a4ea84ac5b40f2f291813c7382617e0c"
Accept-Ranges: bytes
Server: AmazonS3
X-Cache: Miss from cloudfront
Via: 1.1 6ac547ea4fdffc736699ded8bb83b53f.cloudfront.net (CloudFront)
X-Amz-Cf-Id: 7qQVmiE2B3XDneghJFm5GmKv45JztdIe1hkD-zsBsgiNfccI7dN0Ag==

2nd attempt (Hit from CloudFront)

$ curl -I http://d2pgt27y8augeg.cloudfront.net/index.htm
HTTP/1.1 200 OK
Content-Type: text/html
Content-Length: 26987
Connection: keep-alive
Date: Tue, 29 Sep 2015 08:05:02 GMT
Last-Modified: Sun, 27 Sep 2015 14:37:44 GMT
ETag: "a4ea84ac5b40f2f291813c7382617e0c"
Accept-Ranges: bytes

Server: AmazonS3
Age: 259
https://forums.aws.amazon.com/thread.jspa?threadID=216814 4/10
10/24/2017 AWS Developer Forums: Cloudfront domain redirects to S3 ...
Age: 259
X-Cache: Hit from cloudfront
Via: 1.1 8fc65dcda78bf068d73aff832a00116f.cloudfront.net (CloudFront)
X-Amz-Cf-Id: ZGKLJX2jOLziLmYRj71-tAS4R_cWrpLdgj-dbK_f5QkQAg8OQaJdPQ==

Please let us know if you are still being redirected.

Best Regards,

Re: Cloudfront domain redirects to S3 Origin URL Reply

Posted by: pfreund2

Posted on: Sep 29, 2015 1:16 AM

in response to: Jil@AWS

Problem solved for me too.


I did not make any change.

Do you know what happened ?

Re: Cloudfront domain redirects to S3 Origin URL Reply

Posted by: Mohsin@AWS

Posted on: Sep 30, 2015 10:49 AM

in response to: pfreund2

Hello,

As noted earlier, it is most likely the temporary redirect occurred due to the recent creation of the S3 bucket. This
redirect that was experiencing is now resolving as you have mentioned. Please do let us know if you require any
further assistance.

Regards,
Mohsin

Re: Cloudfront domain redirects to S3 Origin URL Reply

Posted by: ratheesahab

https://forums.aws.amazon.com/thread.jspa?threadID=216814 5/10
10/24/2017 AWS Developer Forums: Cloudfront domain redirects to S3 ...
Posted on: Sep 30, 2015 7:43 PM

in response to: Jil@AWS

Hi,

This is resolved now, i guess automatically.


And thanks for letting us know about temporary redirect

Re: Cloudfront domain redirects to S3 Origin URL Reply

Posted by: chamate01

Posted on: Apr 5, 2017 9:57 AM

in response to: ratheesahab

I have done the following as I am based in Singapore and wanted to see how effective edge locations were.
1) Created a bucket in London and added a picture all with public read only permission on bucket and picture.
2) Access picture and it takes as expected about 9 seconds.
3) Created a distribution
4) Once created entered as others the distribution url however it gets re-directed to the bucket url. So basically
does not seem as if cloudfront is picking it up.

so https://d3cm8fvomvh72e.cloudfront.net/IMG_4183.JPG

but instead get re-directed to

http://s3.eu-west-2.amazonaws.com/mark-channing-london/IMG_4183.JPG

What is the issue?

I disabled the cloudfront and then the cloudfront address no longer worked, which is obvious.

Is it just that newer browsers end up showing the actual url as opposed to just showing the cloud front?

At my office on an older version of chrome when used the cloud front url it did not change to the amazon s3 url.

Re: Cloudfront domain redirects to S3 Origin URL Reply

Posted by: chamate01

Posted on: Apr 6 2017 6:55 AM


https://forums.aws.amazon.com/thread.jspa?threadID=216814 6/10
10/24/2017 AWS Developer Forums: Cloudfront domain redirects to S3 ...
Posted on: Apr 6, 2017 6:55 AM

in response to: chamate01

Since re-started distribution seems to be working as expected.

May be the time between creating bucket and setting up distribution affects the outcome?

Re: Cloudfront domain redirects to S3 Origin URL Reply

Posted by: jasonmaurer

Posted on: Jun 29, 2017 9:58 AM

in response to: ratheesahab

There is a bigger problem here when using CloudFront Origin Access Identities with private buckets. My distro is
returning a 307, pointing to the origin s3 file url, but since the bucket is private with no website hosting enabled
(only allowing access through CloudFront), that redirect returns a 403. How can I solve this without making my
bucket public?

Re: Cloudfront domain redirects to S3 Origin URL Reply

Posted by: haploid2k

Posted on: Jul 8, 2017 10:30 AM

in response to: ratheesahab

Sorry to revive this thread, but I am experiencing exactly the same behavior, and invalidating the cloudfront
distribution doesn't seem to help at all.

Re: Cloudfront domain redirects to S3 Origin URL Reply

Posted by: mehdiataws

Posted on: Jul 19, 2017 5:14 PM

in response to: haploid2k

Hi,
Are you still experiencing the redirection issue? Would you let us know of the distribution domain name please?

Re: Cloudfront domain redirects to S3 Origin URL Reply

Posted by: adamrothman


https://forums.aws.amazon.com/thread.jspa?threadID=216814 7/10
10/24/2017 AWS Developer Forums: Cloudfront domain redirects to S3 ...
Posted by: adamrothman

Posted on: Aug 7, 2017 3:54 PM

in response to: mehdiataws

I am experiencing this as well. I just launched a CloudFormation stack that includes an S3 bucket, a CloudFront
distribution, and a few Route 53 record sets.

The CloudFront distribution's domain name is d2v6jyq6mjpcyk.cloudfront.net. When I visit that (or the human-
friendly URL that I have configured via Route 53), I am sent to {my bucket}.s3-us-west-2.amazonaws.com instead.

I have tried invalidating the CloudFront cache, but it has not resolved the issue.

Re: Cloudfront domain redirects to S3 Origin URL Reply

Posted by: mehdiataws

Posted on: Aug 16, 2017 7:19 PM

in response to: adamrothman

Hi,

This is an expected behavior when you create a new bucket. The following pages explains the concept:
http://docs.aws.amazon.com/AmazonS3/latest/dev/VirtualHosting.html

"Amazon S3 routes any virtual hostedstyle requests to the US East (N. Virginia) region by default if you use the
US East (N. Virginia) endpoint (s3.amazonaws.com), instead of the region-specific endpoint (for example, s3-eu-
west-1.amazonaws.com). When you create a bucket, in any region, Amazon S3 updates DNS to reroute the request
to the correct location, which might take time. In the meantime, the default rule applies and your virtual hosted
style request goes to the US East (N. Virginia) region, and Amazon S3 redirects it with HTTP 307 redirect to the
correct region."

Please give some time to S3 until the domain name becomes ready (normally an hour or so). Also, please note,
errors are cached in CloudFront by default. This means "307 Temporary Redirect" is cached for 300 seconds unless
you change it:
http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/custom-error-pages.html

In order to test your cloudfront again, please make sure the cache has been invalidated:
http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Invalidation.html

Hope that helps.

https://forums.aws.amazon.com/thread.jspa?threadID=216814 8/10
10/24/2017 AWS Developer Forums: Cloudfront domain redirects to S3 ...

Re: Cloudfront domain redirects to S3 Origin URL Reply

Posted by: ericsmith2017

Posted on: Aug 24, 2017 7:39 AM

in response to: adamrothman

aws , cloudfront

adamrothman, I'm also having an issue with redirect to S3 Buckets. Mine appears to be with the CloudFront
Distribution. I saved the distro with Yes, Update my bucket policy. I save the distro and waited until it was
Deployed; Enabled. Tried the Cloudfront URL and got a redirect to the S3 bucket. I went into the Distibution, Origin
Tab for the new distro and edited it, and to my surprise my Bucket Permission was listed as No, I will update
permissions.

Were you able to resolve your issue? If so can you explain how.

Regards,
Eric

Re: Cloudfront domain redirects to S3 Origin URL Reply

Posted by: alz70

Posted on: Oct 21, 2017 4:35 PM

in response to: chamate01

It can take a long while to stop getting the 307 redirects that show as the URL changing from the CloudFront URL to
the bucket's URL. I guess even longer than a year ago or whenever CloudFront became part of the free tier. Just
keep trying CURL -I until it returns a hit instead of a miss while using the CloudFront URL. I let it bake way more
than 1 day after waiting for a couple of hours.

View Thread RSS Feeds

Free to join. Only pay for what you use. Sign Up

https://forums.aws.amazon.com/thread.jspa?threadID=216814 9/10
10/24/2017 AWS Developer Forums: Cloudfront domain redirects to S3 ...

Learn Developer Resources Manage Your Account About AWS

Products & Services AWS Marketplace Management Console What is Cloud Computing?
Case Studies Sample Code & Libraries Billing & Cost Management Events & Webinars
Economics Center SDKs & Tools Personal Information Careers at AWS
Architecture Center Documentation Payment Method Contact Us
Security Center Articles & Tutorials AWS Identity & Access Management Announcements (What's New?)
Whitepapers Management Console Security Credentials AWS Blog
Training & Certification Flexible Payments Service Request Service Limit Increases Press Releases
Webinars Media Coverage
Industry Solutions Developer Centers Support Legal
Use Case Solutions
User Groups Java AWS Support

Partners JavaScript Service Health Dashboard


Mobile Discussion Forums
PHP FAQs
Python Contact Support
Ruby
Windows & .NET

Site Terms Privacy Policy 2013, Amazon Web Services, Inc. or its affiliates. All rights reserved.

https://forums.aws.amazon.com/thread.jspa?threadID=216814 10/10

S-ar putea să vă placă și