Why am I getting an HTTP 307 Temporary Redirect response from Amazon S3?
Last updated: 2021-04-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, up to 24 hours can pass before the bucket name propagates 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 must reside in the same Region as your Amazon 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.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 all HTTP requests. For example, if you're using the AWS CLI, include the --region parameter in your request to specify the AWS Region.