Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

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

@chadmyers

Description

@chadmyers

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=.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions