Skip to content

Commit 1dede9d

Browse files
authored
Merge pull request ceph#63151 from xxhdx1985126/wip-rgw-location-https
rgw/rgw_rest: determine the domain uri prefix by rgw_transport_is_secure Reviewed-by: Casey Bodley <[email protected]>
2 parents f7425e7 + 12154f2 commit 1dede9d

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

src/rgw/rgw_rest.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -888,8 +888,7 @@ inline std::string compute_domain_uri(const req_state *s) {
888888
std::string uri = (!s->info.domain.empty()) ? s->info.domain :
889889
[&s]() -> std::string {
890890
RGWEnv const &env(*(s->info.env));
891-
std::string uri =
892-
env.get("SERVER_PORT_SECURE") ? "https://" : "http://";
891+
std::string uri = rgw_transport_is_secure(s->cct, env) ? "https://" : "http://";
893892
if (env.exists("SERVER_NAME")) {
894893
uri.append(env.get("SERVER_NAME", "<SERVER_NAME>"));
895894
} else {

src/rgw/rgw_rest_s3.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5922,7 +5922,7 @@ int RGWHandler_REST_S3Website::retarget(RGWOp* op, RGWOp** new_op, optional_yiel
59225922
if (should_redirect) {
59235923
const string& hostname = s->info.env->get("HTTP_HOST", "");
59245924
const string& protocol =
5925-
(s->info.env->get("SERVER_PORT_SECURE") ? "https" : "http");
5925+
(rgw_transport_is_secure(s->cct, *s->info.env) ? "https" : "http");
59265926
int redirect_code = 0;
59275927
rrule.apply_rule(protocol, hostname, key_name, &s->redirect,
59285928
&redirect_code);
@@ -6053,7 +6053,7 @@ int RGWHandler_REST_S3Website::error_handler(int err_no,
60536053
if (should_redirect) {
60546054
const string& hostname = s->info.env->get("HTTP_HOST", "");
60556055
const string& protocol =
6056-
(s->info.env->get("SERVER_PORT_SECURE") ? "https" : "http");
6056+
(rgw_transport_is_secure(s->cct, *s->info.env) ? "https" : "http");
60576057
int redirect_code = 0;
60586058
rrule.apply_rule(protocol, hostname, original_object_name,
60596059
&s->redirect, &redirect_code);

0 commit comments

Comments
 (0)