diff --git a/Hi.UrlRewrite/Processing/OutboundRewriter.cs b/Hi.UrlRewrite/Processing/OutboundRewriter.cs index 22e163d..f1d19fd 100644 --- a/Hi.UrlRewrite/Processing/OutboundRewriter.cs +++ b/Hi.UrlRewrite/Processing/OutboundRewriter.cs @@ -117,7 +117,8 @@ private OutboundRuleResult ProcessRegularExpressionOutboundRule(OutboundRuleResu var replacements = new RewriteHelper.Replacements { RequestHeaders = RequestHeaders, - RequestServerVariables = RequestServerVariables + RequestServerVariables = RequestServerVariables, + ResponseHeaders = ResponseHeaders }; conditionMatchResult = RewriteHelper.TestConditionMatches(outboundRule, replacements, out lastConditionMatch); @@ -135,7 +136,7 @@ private OutboundRuleResult ProcessRegularExpressionOutboundRule(OutboundRuleResu private bool TestRuleMatches(string responseString, OutboundRule outboundRule, out Match outboundRuleMatch) { // TODO: test against all of the "match the content within" - + string regexPattern = @"<{0}((\s+\w+(\s*=\s*(?:"".*?""|'.*?'|[^'"">\s]+))?)+\s*|\s*)\/?>"; outboundRuleMatch = new Regex(@"").Match(@""); return true; diff --git a/Hi.UrlRewrite/sitecore modules/Shell/UrlRewrite/Default.aspx.cs b/Hi.UrlRewrite/sitecore modules/Shell/UrlRewrite/Default.aspx.cs index 7611c69..fd18449 100644 --- a/Hi.UrlRewrite/sitecore modules/Shell/UrlRewrite/Default.aspx.cs +++ b/Hi.UrlRewrite/sitecore modules/Shell/UrlRewrite/Default.aspx.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Collections.Specialized; using System.Linq; using System.Web; using System.Web.UI; @@ -54,8 +55,17 @@ protected void Page_Load(object sender, EventArgs e) using (new SiteContextSwitcher(siteContext)) using (new DatabaseSwitcher(_db)) { - results = rewriter.ProcessRequestUrl(new Uri(txtUrl.Text), inboundRules); - + var url = new Uri(txtUrl.Text); + rewriter.RequestServerVariables = new NameValueCollection + { + { "HTTP_HOST", url.Host}, + { "HTTPS", url.Scheme.Equals(Uri.UriSchemeHttps) ? "on" : "off" } + }; + if (url.Query.Length > 0) + { + rewriter.RequestServerVariables.Add("QUERY_STRING", url.Query.Remove(0, 1)); + } + results = rewriter.ProcessRequestUrl(url, inboundRules); } if (results == null)