From 5913f584cba6e8fab9f03a7b28c7792d26e01256 Mon Sep 17 00:00:00 2001 From: Seena Fallah Date: Fri, 28 Jun 2024 12:30:54 +0200 Subject: [PATCH] rgw: use s3website REST when higher priority and no host header If the Host header is missing, but the s3website API is enabled and has a higher priority than the regular S3 API, then we should still treat the request as a website request. Fixes: https://tracker.ceph.com/issues/66748 Signed-off-by: Seena Fallah --- src/rgw/rgw_rest.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/rgw/rgw_rest.cc b/src/rgw/rgw_rest.cc index 3a0652e82e2c..102f05d78628 100644 --- a/src/rgw/rgw_rest.cc +++ b/src/rgw/rgw_rest.cc @@ -2164,6 +2164,11 @@ int RGWREST::preprocess(req_state *s, rgw::io::BasicClient* cio) << " s->info.domain=" << s->info.domain << " s->info.request_uri=" << s->info.request_uri << dendl; + } else if (s3website_enabled && api_priority_s3website > api_priority_s3) { + // If the Host header is missing, but the s3website API is enabled and has + // a higher priority than the regular S3 API, then we should still treat + // the request as a website request. + s->prot_flags |= RGW_REST_WEBSITE; } if (s->info.domain.empty()) { -- 2.47.3