By using AWS re:Post, you agree to the Terms of Use
/How to stop CloudFront from redirecting to S3 bucket./

How to stop CloudFront from redirecting to S3 bucket.

0

I have an Amplify Hosting frontend that uses a rewrite redirect (200) to redirect to an S3 bucket. That worked out fine but then I created a CloudFront distribution and since then, the rewrite gives a timeout after 30 seconds serving a 504 error. That is why I disabled and then deleted the CloudFront distribution. However the timeout and 504 error (coming from CloudFront) is still there. Any ideas how to fully remove this CloudFront forwarding or do I have to delete the bucket/frontend?

1 Answers
0

Hi there,I understand you want to delete CloudFront distribution because of 504 error you keep on getting.Please correct me if I misunderstood.

To further understand the issue when getting a 504 error or timeout it indicates that when Cloudfront forwarded a request to the origin ,one of the following might have happened: [1]The origin returned an HTTP 504 status code to CloudFront. [2]The origin didn’t respond before the request expired.

Cloudfront will return an HTTP 504 status code if traffic is blocked to the origin by a firewall or security group if the origin isn’t accessible on the internet.Check for these issues first.If access isn’t the problem with your CloudFront check application delays and server timeouts, using link [3] to help you identify and fix the issue.I would also recommend changing the timeout value to 60 seconds.

However if you no longer want to use a CloudFront distribution, you can delete it by using the CloudFront console or by using the CloudFront API.Please make sure that you have disabled distribution before deleting it.For more instructions on how to delete CloudFront distribution ,use this link for the console [4] and this link [5] for the CloudFront API

I hope the above information is helpful.

Reference

[3]https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/http-504-gateway-timeout.html#http-504-gateway-timeout-configure-firewall [4]https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/HowToDeleteDistribution.html [5]https://docs.aws.amazon.com/cloudfront/latest/APIReference/API_DeleteDistribution.html

answered 22 days 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