Pull request: all: do not redirect to https if not necessary

Merge in DNS/adguard-home from 3558-https-redirect to master

Squashed commit of the following:

commit f656563c0b0db6275748de28bc890dcf85b0e398
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Fri Dec 10 20:44:00 2021 +0300

    all: do not redirect to https if not necessary
This commit is contained in:
Ainar Garipov
2021-12-13 13:48:08 +03:00
parent 86cffcd168
commit a396865869
3 changed files with 6 additions and 3 deletions

View File

@@ -301,10 +301,10 @@ export const redirectToCurrentProtocol = (values, httpPort = 80) => {
const {
protocol, hostname, hash, port,
} = window.location;
const { enabled, port_https } = values;
const { enabled, force_https, port_https } = values;
const httpsPort = port_https !== STANDARD_HTTPS_PORT ? `:${port_https}` : '';
if (protocol !== 'https:' && enabled && port_https) {
if (protocol !== 'https:' && enabled && force_https && port_https) {
checkRedirect(`https://${hostname}${httpsPort}/${hash}`);
} else if (protocol === 'https:' && enabled && port_https && port_https !== parseInt(port, 10)) {
checkRedirect(`https://${hostname}${httpsPort}/${hash}`);