public static bool OnNavigating(NavigatingEventArgs e) { GuardWebServer(); return webServer.OnNavigating(e); }
public bool OnNavigating(NavigatingEventArgs e) { if (BypassUrl(e.Uri.OriginalString, this.configuration.BypassUrlPatterns)) { return false; } if (e.Uri.Authority != this.proxyUri.Authority && (e.Uri.Scheme == "http" || e.Uri.Scheme == "https")) { e.TargetUri = new Uri(this.BuildCurrentProxyUri(this.baseUri, e.Uri.AbsoluteUri)); return true; } if (e.Uri != null && e.Uri.Scheme == "https" && e.Uri.Authority == this.proxyUri.Authority) { var mappedUri = new UriBuilder(e.Uri); mappedUri.Port = this.proxyUri.Port; mappedUri.Scheme = this.proxyUri.Scheme; var queryString = mappedUri.Query.Trim('?'); if (!queryString.Contains(WatBrowserTargetHostQueryStringParameter + "=https")) { mappedUri.Query = queryString.Replace(WatBrowserTargetHostQueryStringParameter + "=http", WatBrowserTargetHostQueryStringParameter + "=https"); } e.TargetUri = mappedUri.Uri; return true; } e.TargetUri = e.Uri; return false; }