1

Web.config defines redirects for not existing pages.

<httpErrors errorMode="Custom" existingResponse="Replace">
  <remove statusCode="403" subStatusCode="-1" />
  <remove statusCode="404" subStatusCode="-1" />
  <remove statusCode="500" subStatusCode="-1" />
  <error statusCode="403" path="/mywebsite/foutmelding/404.html" responseMode="ExecuteURL" />
  <error statusCode="404" path="/mywebsite/foutmelding/404.html" responseMode="ExecuteURL" />
  <error statusCode="500" path="/mywebsite/foutmelding/404.html" responseMode="ExecuteURL" />
</httpErrors>

We also use cache in web.config

  <sdl.web.delivery>
    <caching defaultHandler="regularCache" enabled="true">
   ...

Situation:
Request from browser for https://mywebsite/pagethatdoesntexist

Page doesn't exist on the server. The first time the 404.html renders and gives the result back. A new request from a browser with other pages that doesn't exist also give the 404.html

When the second time a page is requested above then it gives the ServerError.cshtml (not the 404.html page).

Observations:

When we disable the cache (one or both) then it works as expected (it shows 404.html).

... caching defaultHandler="regularCache" enabled="false" ...

or
 
add key="viewModel-caching" value = "false"

UPDATE 8 apr

Did some tests Sample Core webapp works when page (section) is published as '\error-404'.
Exact that filename. It only work with error-404 in root.

enter image description here

web.config line '/mywebsite/foutmelding/404.html' works only once.
Second time (or press F5) results in ServerError.cshtml.

Question:
We need \myfolder\error-404 location (because myfolder is part of accesserver).
Can we configure location 'myfolder'\error-404 ?

4
  • For me. In the OOTB DXA 2.2 - <httpErrors errorMode="DetailedLocalOnly" existingResponse="PassThrough" /> setting working fine as expected. 404.html page coming from tridion.
    – Velmurugan
    Apr 7, 2021 at 13:25
  • That option doesnt work. The 2nd request takes page/view ServerError.html from cache. We want bot option true, we need caching. How can we disable page cache for http result 403,404,500 ? Apr 8, 2021 at 9:07
  • In my case I have enabled caching and tested it works.
    – Velmurugan
    Apr 8, 2021 at 9:22
  • Did update 8 apr (Checked the sample Core webapp + CMS). Apr 8, 2021 at 18:02

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.