File tree 2 files changed +6
-4
lines changed
2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -15,16 +15,18 @@ export function checkNodeUrlValidity(
15
15
newUrl : string ,
16
16
allowInsecure : boolean
17
17
) : string | undefined {
18
+ const isHttpLocalhost =
19
+ newUrl . toLowerCase ( ) . startsWith ( 'http://localhost' ) || newUrl . toLowerCase ( ) . startsWith ( 'http://127.0.0.1' )
20
+
18
21
if ( ! isValidUrl ( newUrl ) ) {
19
22
return 'error.node.invalid'
20
23
}
21
-
22
- if ( ! allowInsecure && ! isValidHttpsUrl ( newUrl ) ) {
24
+ if ( ! allowInsecure && ! isHttpLocalhost && ! isValidHttpsUrl ( newUrl ) ) {
23
25
return 'error.node.https'
24
26
}
25
27
26
28
const hasDefaultHttpsPort = newUrl . endsWith ( ':443' )
27
- if ( hasDefaultHttpsPort ) {
29
+ if ( hasDefaultHttpsPort && ! isHttpLocalhost ) {
28
30
newUrl = newUrl . slice ( 0 , - 4 )
29
31
}
30
32
Original file line number Diff line number Diff line change 1979
1979
"refused" : " The connection was refused." ,
1980
1980
"handshake" : " Could not complete handshake with node." ,
1981
1981
"invalidCertificate" : " Could not connect with invalid certificate." ,
1982
- "https" : " HTTPS is required; insecure connections over HTTP are not supported at this time ." ,
1982
+ "https" : " External connections must use HTTPS; localhost connections can be made using HTTP. Insecure external HTTP connections are not supported ." ,
1983
1983
"duplicate" : " This node has already been added." ,
1984
1984
"noSyncedNode" : " No synced node is available." ,
1985
1985
"timeNotSynced" : " Device time is incorrect, unable to sync node." ,
You can’t perform that action at this time.
0 commit comments