Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(middleware-sdk-s3): add status code 400 for S3 region redirects #6572

Merged
merged 3 commits into from
Oct 17, 2024

Conversation

siddsriv
Copy link
Contributor

@siddsriv siddsriv commented Oct 17, 2024

Issue

Internal JS-5479

Description

Adds status code 400 in conjunction with the error code IllegalLocationConstraintException to also redirect regions for S3, if followRegionRedirects flag is set.

Testing

  • unit test
 PASS  src/validate-bucket-name.spec.ts (8.169 s)
 PASS  src/region-redirect-middleware.spec.ts (8.441 s)
 PASS  src/s3-express/functions/s3ExpressMiddleware.spec.ts
 PASS  src/s3-express/classes/S3ExpressIdentityCacheEntry.spec.ts
 PASS  src/s3-express/classes/S3ExpressIdentityCache.spec.ts (8.34 s)
 PASS  src/s3-express/classes/SignatureV4S3Express.spec.ts (8.549 s)

Test Suites: 9 passed, 9 total
Tests:       24 passed, 24 total
Snapshots:   0 total
Time:        8.999 s, estimated 10 s
Ran all test suites.
Done in 9.52s.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@siddsriv siddsriv requested a review from a team as a code owner October 17, 2024 01:46
if (
err?.$metadata?.httpStatusCode === 301 ||
// err.name === "PermanentRedirect" && --> removing the error name check, as that allows for HEAD operations (which have the 301 status code, but not the same error name) to be covered for region redirection as well
(err?.$metadata?.httpStatusCode === 400 && err?.name === "IllegalLocationConstraintException")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@siddsriv siddsriv merged commit 1f02a26 into aws:main Oct 17, 2024
4 checks passed
@siddsriv siddsriv deleted the s3-redirect-update branch October 17, 2024 14:33
Copy link

github-actions bot commented Nov 1, 2024

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants