[ 
https://issues.apache.org/jira/browse/HDDS-17571?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Siyao Meng updated HDDS-17571:
------------------------------
    Description: 
When {{ozone.s3g.domain.name}} is set and a request's Host header (port 
stripped) matches none of the configured domains, {{VirtualHostStyleFilter}} 
throws {{org.apache.hadoop.fs.InvalidRequestException}}. That is not an 
{{OS3Exception}}, so the client gets HTTP 500 with no S3 error body. The same 
happens for a virtual host style Host with no dot before the domain ("invalid 
format").

AWS SDKs and S3A treat 500 as retryable, so a configuration mistake turns into 
a slow failure that looks like a hang. A common case is a gateway whose own 
FQDN is missing from the domain list: every path style request to it (including 
health probes such as {{HEAD /}}) fails with 500.

Fix: keep rejecting the request, but return an S3 {{400 InvalidRequest}} (via 
{{S3ErrorTable}} / {{wrapOS3Exception}}, like {{AuthorizationFilter}}) naming 
the rejected host, 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 instead was considered and rejected: a 
virtual host style request sent to an unlisted host name would then be read as 
a different operation (for example {{DELETE bucket.host/key}} would become 
DeleteBucket {{key}}).

  was:
When {{ozone.s3g.domain.name}} is set and a request's Host header (port 
stripped) matches none of the configured domains, {{VirtualHostStyleFilter}} 
throws {{org.apache.hadoop.fs.InvalidRequestException}}. That is not an 
{{OS3Exception}}, so the client gets HTTP 500 with no S3 error body. The same 
happens for a virtual host style Host with no dot before the domain ("invalid 
format").

AWS SDKs and S3A treat 500 as retryable, so a configuration mistake turns into 
a slow failure that looks like a hang. A common case is a gateway whose own 
FQDN is missing from the domain list: every path style request to it (including 
health probes such as {{HEAD /}}) fails with 500.

Fix: keep rejecting the request, but return an S3 {{400 InvalidRequest}} (via 
{{S3ErrorTable}} / {{wrapOS3Exception}}, like {{AuthorizationFilter}}) carrying 
the existing message, so clients fail fast with a clear error.

Treating an unmatched Host as path style instead was considered and rejected: a 
virtual host style request sent to an unlisted host name would then be read as 
a different operation (for example {{DELETE bucket.host/key}} would become 
DeleteBucket {{key}}).


> S3 Gateway returns 500 instead of 400 when Host matches no 
> ozone.s3g.domain.name
> --------------------------------------------------------------------------------
>
>                 Key: HDDS-17571
>                 URL: https://issues.apache.org/jira/browse/HDDS-17571
>             Project: Apache Ozone
>          Issue Type: Bug
>          Components: S3
>            Reporter: Siyao Meng
>            Assignee: Siyao Meng
>            Priority: Major
>
> When {{ozone.s3g.domain.name}} is set and a request's Host header (port 
> stripped) matches none of the configured domains, {{VirtualHostStyleFilter}} 
> throws {{org.apache.hadoop.fs.InvalidRequestException}}. That is not an 
> {{OS3Exception}}, so the client gets HTTP 500 with no S3 error body. The same 
> happens for a virtual host style Host with no dot before the domain ("invalid 
> format").
> AWS SDKs and S3A treat 500 as retryable, so a configuration mistake turns 
> into a slow failure that looks like a hang. A common case is a gateway whose 
> own FQDN is missing from the domain list: every path style request to it 
> (including health probes such as {{HEAD /}}) fails with 500.
> Fix: keep rejecting the request, but return an S3 {{400 InvalidRequest}} (via 
> {{S3ErrorTable}} / {{wrapOS3Exception}}, like {{AuthorizationFilter}}) naming 
> the rejected host, 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 instead was considered and rejected: 
> a virtual host style request sent to an unlisted host name would then be read 
> as a different operation (for example {{DELETE bucket.host/key}} would become 
> DeleteBucket {{key}}).



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to