Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

S3 - Invalid authorization header - wrong region when uploading profile image #1502

Open
chadmyers opened this issue Nov 3, 2022 · 2 comments

Comments

@chadmyers
Copy link

I am using the Remote Storage option and have configured an AWS S3 bucket in us-west-2 (Oregon) region. I have set up the endpoint for s3-us-west-2.amazonaws.com. I think I have my S3 bucket and CORS set up properly (since I got a different error when I didn't CORS set up and then I re-read the docs and set it up properly).

When I attempt to upload a profile photo, I get a 200 on the pre-flight check (OPTIONS) but a 400 (Bad Request) error on the attempt to PUT to https://MYBUCKETNAME.s3-us-west-2.amazonaws.com/MYPLANET/2022.11.03..22.55.24-profileimg.jpg

The response body is (formatted for your convenience):

<?xml version="1.0" encoding="UTF-8"?>
<Error>
  <Code>AuthorizationHeaderMalformed</Code>
  <Message>The authorization header is malformed; the region 'us-east-1' is wrong; expecting 'us-west-2'</Message>
  <Region>us-west-2</Region>
  <RequestId>REDACTED</RequestId>
  <HostId>9R+JQSful8AwLA4ys0Xo1hK7iGWgHfXXXks0avFzAOvDrlngITkf2rDpm01NQv4X7lMquM3yp5A=</HostId>
</Error>

The Authorization header on the request is:

Authorization: AWS4-HMAC-SHA256 Credential=REDACTED/20221103/us-east-1/s3/aws4_request, SignedHeaders=host;x-amz-acl;x-amz-content-sha256;x-amz-date;x-amz-user-agent, Signature=REDACTED

Note the us-east-1 in the Credential=.

@chadmyers
Copy link
Author

I'm going to try to make a bucket in us-east-1 and see if that works and report back.

@chadmyers
Copy link
Author

NOTE: If I can get all this working, I am willing to assist in adding AWS-specific information to the Remote Storage config page docs for configuring AWS S3 storage.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant