Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Chriztian Steinmeier 2800 posts 8791 karma points MVP 8x admin c-trib
    Nov 05, 2014 @ 10:14
    Chriztian Steinmeier
    1

    Setting up error pages in a multilingual site

    I've been trying to setup multiple error pages for a multilingual website we're developing, and I've run into problems (and searching the forum, it seems to be a very common problem).

    Setup

    I'm in an Umbraco v6.1.6 - here's a condensed version of the Content tree:

    [Content]
        Global
            Denmark (da-DK)
            Germany (de-DE)
            England (en-GB)
    

    Denmark, Germany and England are root/site nodes so they have their own culture and hostname defined (using the domain.com/dk pattern) - each of them has a childnode named “404" which should be served as the localized error page.

    What I was able to do

    I could set the simple version of an error page in umbracoSettings.config, i.e.: <error404>1234</error404> and have that page be served whenever there was an error. This is described in the documentation

    What I wanted to do

    But as it is, my website is available in three languages and I'd very much like to have a localized version of that error page. So I tried the "culture-aware" version of the above (where the <error404> key has an <errorPage> for each defined culture), but the only thing I could get reliably working, resulted in getting the error page from the first site. That, or I'd get Umbraco's default "intentionally left ugly :-)" page.

    I tried the uComponents MultiSiteNotFoundHandler which is otherwise very simple to setup - have a property named umbracoPageNotFound on the root of every site and point that (via ID) to the site’s own error page. But I couldn't even get that to work, so I'm out of good ideas at the moment.

    (For the record, I've also set the <httpErrors existingResponse="PassThrough" /> key that the documentation page mentions)

    From previous posts I kinda get the feeling that people tend to write their own handlers for this, but that’s not an option for me - I'm really interested in getting to the bottom of why this doesn't work. And if it's just a stupid error by me, I'd like to be able to not do that again next time :)

    I really don’t want to have to write a frickin' handler for something that's supposed to work :-) It's Umbraco - it just works in so many other ways!

    /Chriztian

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    Nov 05, 2014 @ 10:48
    Douglas Robar
    2

    @Chriztian - sounds like the bug with <errorPage> still exists. It should work in the umbracoSettings.config file as noted in the file itself. Bug report here, please vote it up http://issues.umbraco.org/issue/U4-2508

    Perhaps its being broken for so long is why people have started writing their own handlers even for simple situations? In any case, it should be fixed to behave as advertised and as it has worked since at least v3.

    cheers,
    doug.

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Nov 05, 2014 @ 10:48
    Lee Kelleher
    3

    Hi Chriztian,

    There is something that I've found that I need to enable for most of my Umbraco sites - a hidden away flag in umbracoSettings.config. The trySkipIisCustomErrors option is set to false by default, flip it to a true:

    <web.routing
        trySkipIisCustomErrors="true"
        internalRedirectPreservesTemplate="false">
    </web.routing>
    

    I hope this helps? :-)

    Cheers,
    - Lee

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    Nov 05, 2014 @ 10:55
    Douglas Robar
    0

    @Lee - FWIW, that setting made no difference on my sample 7.1.8 site.

    cheers,
    doug.

  • Chriztian Steinmeier 2800 posts 8791 karma points MVP 8x admin c-trib
    Nov 05, 2014 @ 11:37
    Chriztian Steinmeier
    100

    Thanks guys!

    So I did a little "rubber ducking" to assure myself that I wasn't going crazy.

    A little more info:

    The root nodes have an umbracoUrlName property so that the "Denmark" node is accessed as /dk/, "Germany" as /de/ etc.

    Now, when I'd assigned the 404 pages' IDs in umbracoSettings.config, the Germany node wasn't even accessible at /de/, even though its "Link to document" was citing that as its URL? It even gave me the danish 404 page - not even the default one... (what the...??)

    I tried to check the Hostname settings, but when I tried to set its hostname, Umbraco told me that the hostname was already defined - which of course it was - but it was defined on a node that had been trashed.

    When I deleted (really deleted!) that node from the Recycle bin, things started working!

    So I'm guessing that there's a problem between the thingymajiggy stuff that looks up rootnodes by hostnames and the fact that a "hostnamed" node is still visible even when it's been trashed, which ultimately results in the wrong rootnode being returned and thus, the GetCurrentNotFoundPageId() function doesn't find a specific error page?

    Hope this makes sense to the right people :-)

    /Chriztian

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    Nov 05, 2014 @ 11:55
    Douglas Robar
    0

    @Chriztian - you mean you got it working with the umbracoSettings.config file all by itself after you deleted the trashed node?

    I can't get my test site (v7.1.8) to use the culture enabled 404 pages using the umbracoSettings.config items alone. It's a very simple site with two root nodes (each assigned a culture but no hostname; I'm using the <umbracoHideTopLevelNodeFromPath>false</umbracoHideTopLevelNodeFromPath> setting).

    [CONTENT]  
      EN  
        Products  
        News
        Not Found
      DE
        Das Products  
        Das News  
        Das Not Found
    

    If you've gotten this to work I'd love to know how.

    cheers,
    doug.

  • Chriztian Steinmeier 2800 posts 8791 karma points MVP 8x admin c-trib
    Nov 05, 2014 @ 12:04
    Chriztian Steinmeier
    1

    Hi Douglas,

    Yes - it's working; it's actually working :-)

    So I just checked the umbracoHideTopLevelNodeFromPath - it's true in my site (but it's in the form of <add key="umbracoHideTopLevelNodeFromPath" value="true" />).

    And I have hostnames defined using the domain.com/en and domain.com/de pattern, even though I also have umbracoUrlName set to those ("en" and "de").

    And then I've obviously put the 404 pages' IDs in the config...

    /Chriztian

    (BTW: Love how you germanized those pages with "Das" :-)

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    Nov 05, 2014 @ 12:29
    Douglas Robar
    1

    With Chriztian's help a reliable workaround has been found until the bug can be fixed...

    Always include the domain when using 'Culture and Hostnames' if you want to also use the culture-specific not found entries in the umbracosettings.config file, such as:

    <error404>
        <errorPage culture="en-US">1122</errorPage>
        <errorPage culture="es-ES">1121</errorPage>
    </error404>
    

    This also explains why the uComponents MultiSitePageNotFoundHandler didn't work either - it uses the same function to do the domain lookup.

    Thanks, Chriztian for the help!

    cheers,
    doug.

  • Dan 1288 posts 3921 karma points c-trib
    Nov 05, 2014 @ 13:46
    Dan
    3

    Bravo chaps!  This thread IS Umbraco :)

  • Ayo Adesina 445 posts 1059 karma points
    Nov 05, 2014 @ 14:53
    Ayo Adesina
    0

    I had a similar problem, I was just getting a blank white page, and not getting my 404.

    I just tried Lee Kelleher's soultion..

    <web.routing
        trySkipIisCustomErrors="true"
        internalRedirectPreservesTemplate="false">
    </web.routing>
    

    started working straight away can anyone explain what "trySkipIisCustomErrors" actually is?

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Nov 05, 2014 @ 15:15
    Lee Kelleher
    0

    @Ayo - the trySkipIisCustomErrors option is there to ignore IIS from handling custom error pages. Enabling it would mean that you'd like the web-app (e.g. Umbraco) to handle a custom error (404, 500), rather than the web-server (IIS) itself.

    I raised an issue on the tracker about changing the default value to true, but it would be a breaking change - so maybe in v8?
    http://issues.umbraco.org/issue/U4-4997

  • Stephen 767 posts 2273 karma points c-trib
    Apr 25, 2016 @ 12:33
    Stephen
    0

    I know it's old, but... dealing with the "issue" now. A few things:

    • Yes, a hostname on a node in the recycle bin still is a hostname and cannot be assigned until it has been cleared. This is because ppl expect they can move a node to the recycle bin, and then back, and it has not changed (still has its domain).
    • In latest 7.4, it will tell you that you cannot assign the domain because it is already assigned to another node and will tell you which node has it assigned already.
    • TrySkipIisCustomErrors is required to prevent IIS from taking over the error and displaying its own message. It tells IIS that even though the response code is 404, it should not alter the content of the response.

    I just run some tests, including with nodes in the bin, and all seems to work correctly. So... can we clarify the situation / identify what the bug is exactly with repro. instructions?

    One last thing to note is that in order to pick the proper 404 page, there needs to be a proper culture. In the example, site.com/dk/missing would pick the DK 404 page whereas site.com/de/missing would pick the DE 404 page. Because we have been able to match the domains (site.com/dk and site.com/de).

    However, site.com/missing would pick the "default" 404 page because we cannot match a domain, and therefore still have the default culture.

Please Sign in or register to post replies

Write your reply to:

Draft