Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
So I have a simple Plack app that uses the ErrorDocument middleware to serve a custom error.
The app configures the middleware like this:
enable 'ErrorDocument', 403 => '/error/forbidden', 404 => '/error/not_found', subrequest => 1, ;
This works great. However now I'd like to bypass this middleware in certain specific cases and serve an alternate 404 result.
Is that possible? IOW, I want to set the status code to 404 and deliver a special response page, and have the error handler middleware ignore the fact that it's a 404.
I tried setting a value in the $env and using enable_if on the middleware, but it appears the enable_if sub runs before the actual request.
Any suggestions? Thanks
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Plack Custom Error Document
by Anonymous Monk on Nov 21, 2018 at 10:09 UTC |