diff --git a/CHANGELOG.md b/CHANGELOG.md index b96ac4501..1325df431 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ - Fix potential HTTP protocol version mismatch (#8982) - Fix bug where installto.sh/update.sh scripts were removing some essential options from the config file (#9051) - Update jQuery-UI to version 1.13.2 (#9041) +- Fix regression that broke use_secure_urls feature (#9052) ## Release 1.6.2 diff --git a/config/defaults.inc.php b/config/defaults.inc.php index 4a872d7b8..31c89a36f 100644 --- a/config/defaults.inc.php +++ b/config/defaults.inc.php @@ -815,6 +815,7 @@ $config['no_save_sent_messages'] = false; // Warning: This requires http server configuration. Sample: // RewriteRule ^/roundcubemail/[a-zA-Z0-9]{16}/(.*) /roundcubemail/$1 [PT] // Alias /roundcubemail /var/www/roundcubemail/ +// Warning: This feature does NOT work with request_path = 'SCRIPT_NAME' // Note: Use assets_path to not prevent the browser from caching assets $config['use_secure_urls'] = false; diff --git a/program/include/rcmail.php b/program/include/rcmail.php index 83e56e72b..a9ab5b678 100644 --- a/program/include/rcmail.php +++ b/program/include/rcmail.php @@ -1171,7 +1171,7 @@ class rcmail extends rcube $path = $_SERVER[$path]; } else if (empty($path)) { - foreach (['REDIRECT_SCRIPT_URL', 'SCRIPT_NAME', 'REQUEST_URI'] as $name) { + foreach (['REQUEST_URI', 'REDIRECT_SCRIPT_URL', 'SCRIPT_NAME'] as $name) { if (!empty($_SERVER[$name])) { $path = $_SERVER[$name]; break; diff --git a/program/include/rcmail_oauth.php b/program/include/rcmail_oauth.php index 909580ffb..cd5ad08bb 100644 --- a/program/include/rcmail_oauth.php +++ b/program/include/rcmail_oauth.php @@ -120,8 +120,14 @@ class rcmail_oauth */ public function get_redirect_uri() { + $url = $this->rcmail->url([], true, true); + // rewrite redirect URL to not contain query parameters because some providers do not support this - return preg_replace('/\/?\?_task=[a-z]+/', '/index.php/login/oauth', $this->rcmail->url([], true, true)); + // also make sure to not duplicate the index.php/... path + $url = preg_replace('/\?.*/', '', $url); + $url = preg_replace('/index\.php.*$/', '', $url); + + return slashify($url) . 'index.php/login/oauth'; } /**