Repository navigation
HDDS-17571. S3 Gateway should return 400 instead of 500 when Host matches no ozone.s3g.domain.name - #11854
Merged
Conversation
…o ozone.s3g.domain.name Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
adoroszlai
marked this pull request as ready for review
October 31, 2026 12:53
adoroszlai
approved these changes
Oct 31, 2026
Contributor
|
Thanks @smengcl for the patch. |
Contributor
Author
|
Thanks @adoroszlai for the review. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Generated-by: Claude Code (Opus 5.5)
What changes were proposed in this pull request?
When
ozone.s3g.domain.nameis set and the Host header (port stripped) matches none of the configured domains,VirtualHostStyleFilterthrowsorg.apache.hadoop.fs.InvalidRequestException. It is not anOS3Exception, so the client gets HTTP 500 with no S3 error body. The same applies to a virtual host style Host with no dot before the domain.AWS SDKs and S3A retry 500s, so a configuration mistake shows up as a slow failure that looks like a hang. For example, if the gateway's own FQDN is missing from the domain list, every path style request to it (including a health probe
HEAD /) fails with 500.This patch keeps rejecting those requests but returns an S3
400 InvalidRequestnaming the rejected host, usingS3ErrorTableandwrapOS3Exceptionthe same wayAuthorizationFilterdoes, so clients fail fast with a clear error. The configured domain list and the request URI are logged at debug level instead of being returned, since the client is not authenticated at this point.Treating an unmatched Host as path style was considered instead, but then a virtual host style request sent to an unlisted host name would be read as a different operation (for example
DELETE bucket.host/keywould become DeleteBucketkey).What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-17571
How was this patch tested?
Extended
TestVirtualHostStyleFilter: the existing rejection cases (including the IPv6 ones) now assert a 400InvalidRequest, and a new case covers a path style request whose Host is missing from the domain list.🤖 Generated with Claude Code