diff --git a/chromium/background.js b/chromium/background.js index 6065faba479a..7422343dde12 100644 --- a/chromium/background.js +++ b/chromium/background.js @@ -226,14 +226,12 @@ function onBeforeRequest(details) { const uri = new URL(details.url); // Should the request be canceled? - var shouldCancel = ( - httpNowhereOn && - uri.protocol === 'http:' && - !/\.onion$/.test(uri.hostname) && - !/^localhost$/.test(uri.hostname) && - !/^127(\.[0-9]{1,3}){3}$/.test(uri.hostname) && - !/^0\.0\.0\.0$/.test(uri.hostname) - ); + var shouldCancel = httpNowhereOn && + uri.protocol !== 'https:' && + uri.hostname.slice(-6) !== '.onion' && + uri.hostname !== 'localhost' && + !/^127(\.(25[0-5]|2[0-4][0-9]|[01]?[0-9]{1,2})){3}$/.test(uri.hostname) && + uri.hostname !== '[::1]'; // Normalise hosts such as "www.example.com." var canonical_host = uri.hostname;