<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-M74D8PB" height="0" width="0" style="display:none;visibility:hidden">
Loading
Skip to NavigationSkip to Main Content

How to Redirect Users to a Specific URL Based on the HTTP Status Code

Access Gateway
Okta Classic Engine
Okta Identity Engine

Overview

In some scenarios, users may need to be redirected to a specific error page(s) based on the HTTP status returned from the OAG application. To achieve this, a directive has to be set to intercept the errors through a policy that can then redirect users to the required URL. 

Applies To

  • Okta Access Gateway

Solution

  1. Edit the application and go to the policy section.
  2. Edit root policy and click on the Advanced tab.
  3. Add the following directive in the advanced section: 
    proxy_intercept_errors on;
    error_page 404 502 503 504 https://okta.com;
    The above policy will send the users to https://okta.com whenever an HTTP 404, 502, 503, or 504 error is received by the backend application or the application is unresponsive.
  4. Click on Not Validated to validate the setting and save the application. 
Loading
Okta Support - How to Redirect Users to a Specific URL Based on the HTTP Status Code