Skip to content

Commit

Permalink
Merge pull request #8754 from jackyalbo/jacky-cors-fixes
Browse files Browse the repository at this point in the history
CORS - Fixing max_age_seconds to number and not string
  • Loading branch information
jackyalbo authored Feb 3, 2025
2 parents 65e2df2 + 6b6d3fb commit 3fc59d6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/endpoint/s3/ops/s3_put_bucket_cors.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ async function put_bucket_cors(req) {
allowed_origins: rule.AllowedOrigin,
expose_headers: rule.ExposeHeader,
id: rule.ID,
max_age_seconds: rule.MaxAgeSeconds,
max_age_seconds: rule.MaxAgeSeconds && parseInt(rule.MaxAgeSeconds, 10),
}, _.isUndefined)
);
await req.object_sdk.put_bucket_cors({
Expand Down
1 change: 1 addition & 0 deletions src/util/http_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,7 @@ function set_cors_headers_s3(req, res, cors_rules) {
}));
if (matched_rule) {
// https://docs.aws.amazon.com/AmazonS3/latest/API/RESTCommonResponseHeaders.html
dbg.log0('set_cors_headers_s3: found matching CORS rule:', matched_rule);
set_cors_headers(req, res, {
allow_origin: matched_rule.allowed_origins.includes('*') ? '*' : req.headers.origin,
allow_methods: matched_rule.allowed_methods.join(','),
Expand Down

0 comments on commit 3fc59d6

Please sign in to comment.