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.
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 ?