File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed
src/Servers/Kestrel/Core/src/Internal Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -152,14 +152,12 @@ bool IsLocalhost(string host, out string? prefix)
152152 }
153153
154154 // Check for use of .localhost TLD (Top Level Domain)
155- if ( host . EndsWith ( ".localhost" , StringComparison . OrdinalIgnoreCase ) )
155+ if ( host . EndsWith ( ".localhost" , StringComparison . OrdinalIgnoreCase )
156+ && ! string . Equals ( parsedAddress . Host , ".localhost" , StringComparison . OrdinalIgnoreCase ) )
156157 {
157- if ( host . LastIndexOf ( '.' ) > 0 )
158- {
159- // Take all but the .localhost TLD as the prefix
160- prefix = host [ ..^ 10 ] ; // 10 is the length of ".localhost"
161- return true ;
162- }
158+ // Take all but the .localhost TLD as the prefix
159+ prefix = host [ ..^ 10 ] ; // 10 is the length of ".localhost"
160+ return true ;
163161 }
164162
165163 prefix = null ;
You can’t perform that action at this time.
0 commit comments