Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/Servers/Kestrel/Core/src/Internal/AddressBinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,10 @@ bool IsLocalhost(string host, out string? prefix)
// Check for use of .localhost TLD (Top Level Domain)
if (host.EndsWith(".localhost", StringComparison.OrdinalIgnoreCase))
{
var localhostTldIndex = host.LastIndexOf('.');
if (localhostTldIndex > 0)
if (host.LastIndexOf('.') > 0)
{
// Take all but the .localhost TLD as the prefix
prefix = host[..localhostTldIndex];
prefix = host[..^10]; // 10 is the length of ".localhost"
return true;
}
}
Expand Down
Loading