Skip to content

Commit db5809b

Browse files
committed
Fix notations of loopback addresses
127.0.0.1/8 refers to only a single IPv4 address "127.0.0.1" that have the subnet mask 255.255.255.0, but doesn't to 127.0.0.2. 127.0.0.0/8, which is the exact definition of the loopback addresses [1][2], includes what the regex says (127.0.0.0-127.255.255.255). [1] https://tools.ietf.org/html/rfc1122 [2] https://tools.ietf.org/html/rfc6890
1 parent 30fc0bf commit db5809b

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

packages/react-scripts/template-typescript/src/serviceWorker.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const isLocalhost = Boolean(
1414
window.location.hostname === 'localhost' ||
1515
// [::1] is the IPv6 localhost address.
1616
window.location.hostname === '[::1]' ||
17-
// 127.0.0.1/8 is considered localhost for IPv4.
17+
// 127.0.0.0/8 are considered localhost for IPv4.
1818
window.location.hostname.match(
1919
/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/
2020
)

packages/react-scripts/template/src/serviceWorker.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const isLocalhost = Boolean(
1414
window.location.hostname === 'localhost' ||
1515
// [::1] is the IPv6 localhost address.
1616
window.location.hostname === '[::1]' ||
17-
// 127.0.0.1/8 is considered localhost for IPv4.
17+
// 127.0.0.0/8 are considered localhost for IPv4.
1818
window.location.hostname.match(
1919
/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/
2020
)

0 commit comments

Comments
 (0)