Okta Access Gateway URL Rewrite Rules Fail to Redirect Correctly
Last Updated:
Overview
When administrators enable URL rewrites in Okta Access Gateway (OAG), the rewrite rules fail, and some links and redirects point the browser to the wrong URL. This issue occurs because the subs_filter directive only processes text/html documents by default. Resolve this by enabling content-rewrite or adding specific content types to the advanced directives.
The following code block displays an example of the failing rewrite rules:
# replace source (internal....) with destination (app1...) using flags ig
# i: ignore case
# g: replace all matched strings
subs_filter internaldomain1.okta.com app1.okta.com ig;
subs_filter internaldomain2.okta.com app1.okta.com ig;
Applies To
- Okta Identity Engine (OIE)
- Okta Classic Engine
- Okta Access Gateway (OAG)
Cause
By default, the subs_filter directive only processes text/html documents. If the response content type is not text/html, the rewrite rules fail.
The following image displays how to check the content type from the browser developer tools in the response header section.
Solution
How are URL rewrite rules fixed in Okta Access Gateway?
Enable the content-rewrite setting or add specific content types to the advanced directives to resolve the rewrite rule failures by performing the following actions.
- Enable Content Rewrite to process many content types.
- If enabling content-rewrite does not resolve the issue, set the following directives in the advanced directive section to add a specific content type, such as
application/json:# specify the types of files to process subs_filter_types application/json; - If adding a specific content type fails, use a wildcard to process all types:
# specify the types of files to process subs_filter_types *;
