diff --git a/src/targets/sw/index.html b/src/targets/sw/index.html
index 50a4d70c4c..c61a952006 100644
--- a/src/targets/sw/index.html
+++ b/src/targets/sw/index.html
@@ -27,7 +27,7 @@
})
}
- if (location.host !== 'localhost' && location.protocol === 'http:') {
+ if (location.hostname !== 'localhost' && location.protocol === 'http:') {
location.replace(location.href.replace('http://', 'https://'))
} else {
register()