Skip to content

Commit 45d8a8b

Browse files
Allows watching URLs on a specific port only. Closes #550 (#551)
1 parent bd75b11 commit 45d8a8b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

dev-proxy/ProxyEngine.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,13 @@ private void LoadHostNamesFromUrls()
306306
hostToWatch = urlToWatchPattern;
307307
}
308308

309+
// remove port number if present
310+
var portPos = hostToWatch.IndexOf(":");
311+
if (portPos > 0)
312+
{
313+
hostToWatch = hostToWatch.Substring(0, portPos);
314+
}
315+
309316
var hostToWatchRegexString = Regex.Escape(hostToWatch).Replace("\\*", ".*");
310317
Regex hostRegex = new Regex($"^{hostToWatchRegexString}$", RegexOptions.Compiled | RegexOptions.IgnoreCase);
311318
// don't add the same host twice

0 commit comments

Comments
 (0)