Describe the bug
This is a bit of a nitpick, since regions don't work the same way, but for the sake of compatibility, the S3 response to a gibberish region is this error (a 400):
HTTP/1.1 400 Bad Request
x-amz-request-id: Z3WJXXH6QRS58J9G
x-amz-id-2: rf+J4P33GViDY3FgK/vBxfCTOOsNh2Zng224Ky2V+TwVrXSPE6XlQ1W2JV4Fjjhw4X26uF9PKkE=
Content-Type: application/xml
Transfer-Encoding: chunked
Date: Tue, 03 Mar 2026 21:28:47 GMT
Connection: close
Server: AmazonS3
<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>InvalidArgument</Code><Message>Argument value abc is not a valid AWS Region</Message><ArgumentName>bucket-region</ArgumentName><RequestId>Z3WJXXH6QRS58J9G</RequestId><HostId>rf+J4P33GViDY3FgK/vBxfCTOOsNh2Zng224Ky2V+TwVrXSPE6XlQ1W2JV4Fjjhw4X26uF9PKkE=</HostId></Error>
To Reproduce
- Start versitygw, e.g.:
./versitygw --access=AKIA**** --secret=******** --region=us-east-1 --iam-dir=/Users/lukemccrone/devel/versitygw/iam --cert /Users/lukemccrone/devel/versitygw/cert.pem --key /Users/lukemccrone/devel/versitygw/versitygw.pem posix --versioning-dir /tmp/versioning /tmp/gw
- Attempt to send ListBuckets command with bad region, e.g.:
curl -iks https://localhost:7070/?bucket-region=abc -H Authorization: AWS4-HMAC-SHA256 Credential=AKIA6****/20260303/us-east-1/s3/aws4_request,SignedHeaders=host;x-amz-content-sha256;x-amz-date,Signature=aac43c8b8b4ade0b6917ba3ac715653e5c5c3ab1d70ff00d8884b147c35304c6 -H host: localhost:7070 -H x-amz-content-sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 -H x-amz-date: 20260303T215803Z
Expected behavior
A similar error to that of S3 is returned.
Server Version
Version : v1.3.1
Build : 9d9fcd9
BuildTime: 2026-03-03_09:59:18PM
Darwin Lukes-MacBook-Pro.local 24.6.0 Darwin Kernel Version 24.6.0: Mon Jul 14 11:28:30 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T6030 arm64
Describe the bug
This is a bit of a nitpick, since regions don't work the same way, but for the sake of compatibility, the S3 response to a gibberish region is this error (a 400):
To Reproduce
./versitygw --access=AKIA**** --secret=******** --region=us-east-1 --iam-dir=/Users/lukemccrone/devel/versitygw/iam --cert /Users/lukemccrone/devel/versitygw/cert.pem --key /Users/lukemccrone/devel/versitygw/versitygw.pem posix --versioning-dir /tmp/versioning /tmp/gwcurl -iks https://localhost:7070/?bucket-region=abc -H Authorization: AWS4-HMAC-SHA256 Credential=AKIA6****/20260303/us-east-1/s3/aws4_request,SignedHeaders=host;x-amz-content-sha256;x-amz-date,Signature=aac43c8b8b4ade0b6917ba3ac715653e5c5c3ab1d70ff00d8884b147c35304c6 -H host: localhost:7070 -H x-amz-content-sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 -H x-amz-date: 20260303T215803ZExpected behavior
A similar error to that of S3 is returned.
Server Version
Version : v1.3.1
Build : 9d9fcd9
BuildTime: 2026-03-03_09:59:18PM
Darwin Lukes-MacBook-Pro.local 24.6.0 Darwin Kernel Version 24.6.0: Mon Jul 14 11:28:30 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T6030 arm64