bland-finland-95044
02/28/2024, 4:46 PMchilly-king-10285
02/28/2024, 4:46 PMchilly-king-10285
02/28/2024, 4:46 PMbland-finland-95044
02/28/2024, 5:18 PMchilly-king-10285
02/28/2024, 5:18 PMchilly-king-10285
02/28/2024, 5:19 PMredirect
error handler and specifies different when
conditions for the 401 and 403 HTTP status codes. Note that in Ory Oathkeeper's configuration, error names are derived from HTTP status messages, with lowercase and underscores. Therefore, unauthorized
corresponds to a 401 error, and forbidden
corresponds to a 403 error. yaml # .oathkeeper.yaml errors: handlers: redirect: enabled: true config: when: - error: - unauthorized # Redirect path for 401 Unauthorized errors to: <http://webpageA> - error: - forbidden # Redirect path for 403 Forbidden errors to: <http://webpageB>
In this configuration: - When an unauthorized
(401) error occurs, the user is redirected to <http://webpageA>
. - When a forbidden
(403) error occurs, the user is redirected to <http://webpageB>
. This setup allows you to handle different error conditions with specific redirects, improving the user experience by directing them to the appropriate webpage based on the error encountered. For more information on configuring error handlers in Ory Oathkeeper, including the use of the when
key for matching specific conditions, you can refer to the Ory documentation on error handling and matchers: - [Ory Oathkeeper Error Handlers](https://www.ory.sh/docs/oathkeeper/pipeline/error) - [Ory Oathkeeper Matchers](https://www.ory.sh/docs/oathkeeper/pipeline/error#matchers)