Copied to clipboard

Flag this post as spam?

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


  • Hamish 96 posts 154 karma points
    Feb 17, 2020 @ 00:17
    Hamish
    0

    Cache bypassed when using Not Found Error Page

    I've setup Umbraco 7.14.0 to handle 404/not found pages as described here: https://our.umbraco.com/documentation/Reference/Config/umbracoSettings/#errors

    The redirect to the error page in Umbraco is working, however I have noticed it ignores caching.

    Example: When I visit any of the following pages (non valid pages/paths - should 404)

    • example.com/page-not-here
    • example.com/page-not-here-either
    • example.com/doh/page-not-here-either

    The node that Umbraco directs to is executed each time and bypasses any caching. Even refreshing the page still executes the template and its cached partials every time.

    However, when i go directly to the error page in Umbraco:

    • example.com/opps-page-not-found/ - The cached partials are correctly cached and not executed until the cache/s has expired.

    What I expected - all pages that are not found, would use a cached version of example.com/opps-page-not-found/ if available.

    Is this an expected behaviour? How do I get Not Found redirects to use caching

    An example of current configuration is: UmbracoSettings.config

    <errors>
      <error404>/root/Home//Error</error404> 
    </errors>
    

    Web.config:

    <system.webServer>
    <httpErrors errorMode="Custom" existingResponse="Replace">
      <remove statusCode="500"/>
      <error statusCode="500" path="500.html" responseMode="File"/>
      <remove statusCode="400"/>
      <error statusCode="400" path="400.html" responseMode="File"/>
      <remove statusCode="404"/>
      <!--Adding a fake path to the 404 so it can redirect to umbraco 404 page-->
      <error statusCode="404" path="errors-404" responseMode="ExecuteURL"/>
    </httpErrors>
    

Please Sign in or register to post replies

Write your reply to:

Draft