Why am I getting an HTTP 307 Temporary Redirect response from Amazon S3?
Last updated: 2021-01-05
When I send requests to an Amazon Simple Storage Service (Amazon S3) bucket, Amazon S3 returns a 307 Temporary Redirect response. Why am I receiving this error?
After you create an Amazon S3 bucket, it can take up to 24 hours for the bucket name to propagate across all AWS Regions. During this time, you might receive the 307 Temporary Redirect response for requests to regional endpoints that aren't in the same Region as your bucket. For more information, see Temporary request redirection.
To avoid the 307 Temporary Redirect response, send requests only to the regional endpoint in the same Region as your S3 bucket:
- If you're using the AWS Command Line Interface (AWS CLI) to access the bucket, configure the AWS CLI. Your AWS CLI should reside in the same Region as your S3 bucket.
Note: If you receive errors when running AWS CLI commands, make sure that you’re using the most recent AWS CLI version.
- If you're using an Amazon CloudFront distribution with an Amazon S3 origin, CloudFront forwards requests to the default S3 endpoint (s3.amazonaws.com). The default S3 endpoint is in the us-east-1 Region. If you must access Amazon S3 within the first 24 hours of creating the bucket, you can change the origin domain name of the distribution. The domain name must include the regional endpoint of the bucket. For example, if the bucket is in us-west-2, you can change the origin domain name from awsexamplebucketname.s3.amazonaws.com to awsexamplebucket.s3-website.us-west-2.amazonaws.com.
Tip: To reduce the number of DNS redirects and DNS propagation issues, specify the AWS Region of your bucket in any HTTP requests. For example, if you're using the AWS CLI, include the --region parameter in your request to specify the AWS Region.