We are building a sophisticated error page logic, e.g. if back end receives an error while reading a database we want to display a specific 503 error or if there is another type of error that we want to avoid showing we want to display 404 error.
Still we want to set the caching time for this error page dynamically: depending on the type of error 1 minute, 5 minutes, 1 hour, etc. So we need to somehow leave headers from the original request (that returned us the 404 or 503 response) but return to a user content from another url /404/ or /503/ respectively.
In other words: you request /xyz/ and get the headers from that url but content is taken from /404/. Is it possible to substitute content like that?