6

Is there a way that for certain URLs (like /blog/*) to load the content from other server, i.e implementing a reverse proxy?

We were able to do this with a normal site (non Sitecore) but when Sitecore is present it seems that the URL rules from our web.config or http://www.helicontech.com/isapi_rewrite/ are ignored and the rules from Sitecore take precedence and when accessing the URL instead of getting the content from the other site (i.e. reverse proxy working) we get the Sitecore 404 page.

Is there a way to do this with Sitecore? Maybe set thing up in a way that for certain URL patterns Sitecore is bypassed and the web.config and/or Helicon module rules are executed instead (which have support for reverse proxy)?

  • 3
    Did you try appending the urls to the IgnoreUrlPrefixes setting in Sitecore config? – jammykam Jan 3 '17 at 8:58
  • Not yet, I'll ask the devs if they tried this. Thanks. – daniels Jan 3 '17 at 8:59
  • Check the module load order and make sure the UrlRewrite is executed before any Sitecore modules. – Richard Hauer Jan 3 '17 at 20:57
  • @daniels is the answer working for you what I provided? would be nice to have a feedback on that. – Tamás Tárnok Jan 6 '18 at 9:50
  • We end up using CloudFlare to act as both CDN (caching) and reverse proxy – daniels Jan 6 '18 at 13:32
8

We faced the same issue about a month ago. You can use the following rewrite rule.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
    <rewrite>
        <rule name="Blog rewrite" enabled="true" >
          <match url="^blog/(.*)$" />
          <action type="Rewrite" url="http://your.other.domain/{R:0}" />
        </rule>
      </rules>
    </rewrite>
  </system.webServer>
</configuration>

We also had to ignore the route for the blog because of MVC route resolving.

using System.Web.Routing;
using Sitecore.Mvc.Pipelines.Loader;
using Sitecore.Pipelines;


namespace MyProject
{
    public class RegisterRoutes : InitializeRoutes
    {
        public override void Process(PipelineArgs args)
        {
            RouteTable.Routes.Ignore("blog/{*pathInfo}");
        }
    }
}

Related config:

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <pipelines>
      <initialize>
        <processor type="MyProject.RegisterRoutes, MyProject" patch:before="processor[@type='Sitecore.Mvc.Pipelines.Loader.InitializeRoutes, Sitecore.Mvc']" />
      </initialize>
    </pipelines>
  </sitecore>
</configuration>

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.