Skip to content

HDDS-14386. Support bucket CORS configuration#10138

Open
ivandika3 wants to merge 19 commits intoapache:masterfrom
ivandika3:HDDS-14386
Open

HDDS-14386. Support bucket CORS configuration#10138
ivandika3 wants to merge 19 commits intoapache:masterfrom
ivandika3:HDDS-14386

Conversation

@ivandika3
Copy link
Copy Markdown
Contributor

@ivandika3 ivandika3 commented Apr 25, 2026

What changes were proposed in this pull request?

Currently, Ozone does not support per-bucket CORS configuration. This means that the CORS configuration is only decided on the reverse proxy that we use (e.g. nginx , HAProxy, etc).

We can implement per-bucket CORS configuration (https://docs.aws.amazon.com/AmazonS3/latest/userguide/cors.html) in Ozone. This way, we can have a separate bucket CORS response for different buckets. CORS is useful if user wanted to fetch S3 object using the browser which respects the CORS mechanism (CORS preflight request, origin validation, response header that can be exposed).

Generated by Codex (GPT 5.4).

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-14386

How was this patch tested?

UT, IT, Acceptance Tests.

Clean CI: https://github.com/ivandika3/ozone/actions/runs/24946282586

@ivandika3 ivandika3 added s3 S3 Gateway AI-gen labels Apr 25, 2026
@ivandika3 ivandika3 self-assigned this Apr 25, 2026
@ivandika3 ivandika3 requested a review from ChenSammi April 26, 2026 04:33
@ivandika3 ivandika3 marked this pull request as ready for review April 26, 2026 07:32
return corsConfiguration != null;
}

public boolean shouldClearCorsConfiguration() {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit

Suggested change
public boolean shouldClearCorsConfiguration() {
public boolean ClearCorsConfiguration() {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hm, clearCorsConfiguration seems like an action although this is a getter. If you'd like we can rename it to isClearCorsConfiguration?

Comment on lines +240 to +250
if (ex.getResult() == ResultCodes.BUCKET_NOT_FOUND
|| ex.getResult() == ResultCodes.VOLUME_NOT_FOUND) {
throw newError(S3ErrorTable.NO_SUCH_BUCKET, bucketName, ex);
} else if (ex.getResult() == ResultCodes.INVALID_TOKEN) {
throw newError(S3ErrorTable.ACCESS_DENIED,
s3Auth.getAccessID(), ex);
} else if (ex.getResult() == ResultCodes.PERMISSION_DENIED) {
throw newError(S3ErrorTable.ACCESS_DENIED, bucketName, ex);
} else if (ex.getResult() == ResultCodes.TIMEOUT ||
ex.getResult() == ResultCodes.INTERNAL_ERROR) {
throw newError(S3ErrorTable.INTERNAL_ERROR, bucketName, ex);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

can we reuse existing error handler for get bucket?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI-gen s3 S3 Gateway

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants