Multisite returns main site after a short while

Member since: 2007

Cms version 10.10.4 (on prem)

So i have this stange behavior, both in production and staging. NOT in dev.

We newly added a site to a one site setup. We are runing it on the same IIS app-pool and website. Different binding are applied. Setup in admin/websites where main site has a *. - working - is at startup working fine, then after a short while, returns the content of the mainsite under the new domain. returns the new site always = good returns the page on new site

So it is only the root returning wrong content

It is not the local cache.

So im thinking is something on the network? fooling episerver? we are using "netscaler"-product, we are using SSL, we are using 301 redirects to SSL.

What can it be? any hints appreciated


Note: As a workaround, i had to run the sites in different IIS websites/app-pools. Then it works.

#192074 Edited, May 05, 2018 6:25
  • Johan Björnfot
    Member since: 2004

    Hmm, sounds strange. That sounds like the resolving of SiteDefinition.Current for some reason returns wrong site. As the algioritm works it will look at Authority part of HttpRequestBase.Url and match that value against the hosts for the different sites. 

    Could it be that there is some proxy or similar that does some rewrite/redirect? But then on the other hand that would not explain that it is only the start page that gets wrong site... But that would explain why you would get the main site, since all unknown hosts will be using the wildcard site.

    Do you have any logs where wou can see the request url as it appears to the application? Just to verify that it is no rewrite going on.

    #192098 May 07, 2018 9:10

    How do you resolve and

    We had a similar issue with a reverse proxy, it turned out that the RP caching flipped when having multiple hostnames on the same application. We had to separate the sites in the cache adding the correct headers based on the current site, I cannot really remember what it was but some proxy_pass or similar.

    We detected the issue by adding log events to the start page detecting the additional sites never got any hits when the main site had been cached by the RP. This could also be the reason your subpages works just fine but if you have the same address to a page on the main and new site you will probably get the page served first

    i.e. and, if main is loaded first you'll get that page also when trying to load the page.

    #192114 May 07, 2018 22:03
    Member since: 2007
    <!DOCTYPE html> <html> <head> </head> <body>

    Seems to be episerver applicationsettings httpCacheVaryByCustom and httpCacheVaryExpiration

    When i change httpCacheVaryByCustom from "path" to "host" it works

    BUT it only caches the, not

    Im printing @DateTime.Now.Ticks to be able to found out this... 

    How come httpCacheVaryExpiration only works on mainsite? 

    </body> </html>
    #196733 Sep 10, 2018 15:25

    May be this is useful to someone in future. We had the same exact problem with episerver 11.10. The site was hosted with Episerver DXC with 10 multisites. The random start website page shows up however url stays intact. The underlying pages work fine.

    Adding httpCacheVaryByCustom="host" solved nothing <applicationSettings httpCacheVaryByCustom="host" />

    As a workaround, I had to remove caching from start page types for varying host names:

        public class StartPageController : BasePageController<StartPage>
            [OutputCache(VaryByCustom = "Host", Duration = 120)]
            // OR [OutputCache(Location = OutputCacheLocation.None, NoStore = true )] // depending on your need
            public override ActionResult Index(StartPage currentPage)
                var model = new PageViewModel<StartPage>(currentPage);
                return View(model);

    And in Global.asax.cs

            public override string GetVaryByCustomString(HttpContext context, string arg)
                if (arg.Equals("Host"))
                    return context.Request.Url.Host;
                return base.GetVaryByCustomString(context, arg);
    #200700 Edited, Jan 23, 2019 9:22
    Member since: 2007

    Totally forgot to write an answer to this. I marked yours as an answer.

    Turned out that one of my Startpage MVC controller was using

    [OutputCache(Duration = 120)]

    And the other did not use outputcache, so i removed all outputcache and it worked for me.

    #200726 Jan 23, 2019 14:38