mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2025-04-30 13:11:37 +03:00
Redirect on port change
This commit is contained in:
parent
8c406427af
commit
24154f0033
2 changed files with 8 additions and 4 deletions
client/src/helpers
|
@ -142,12 +142,16 @@ export const getWebAddress = (ip, port = '') => {
|
|||
};
|
||||
|
||||
export const redirectToCurrentProtocol = (values) => {
|
||||
const { protocol, hostname, hash } = window.location;
|
||||
const {
|
||||
protocol, hostname, hash, port,
|
||||
} = window.location;
|
||||
const { enabled, port_https } = values;
|
||||
const httpsPort = port_https !== 443 ? `:${port_https}` : '';
|
||||
|
||||
if (protocol !== 'https:' && enabled && port_https) {
|
||||
const port = port_https !== 443 ? `:${port_https}` : '';
|
||||
window.location.replace(`https://${hostname}${port}/${hash}`);
|
||||
window.location.replace(`https://${hostname}${httpsPort}/${hash}`);
|
||||
} else if (protocol === 'https:' && enabled && port_https && port_https !== port) {
|
||||
window.location.replace(`https://${hostname}${httpsPort}/${hash}`);
|
||||
} else if (protocol === 'https:' && (!enabled || !port_https)) {
|
||||
window.location.replace(`http://${hostname}/${hash}`);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue