How to Change the Redirect URL After Logout
Overview
This article provides a guide on customizing the redirect URL that users are sent to after logging out of your web application. By default, the logout process redirects users to a predefined path, but tailoring this behavior can enhance the user experience by directing them to a more relevant or branded page.
Default Logout Behavior
By default, the logout URL follows this structure:
https://phenixid.se/selfservice/authenticate/logout/?nextTarget=/selfservice/
In this example, after logging out, the browser redirects to /selfservice/
. You can change the nextTarget
parameter to redirect users to a different URL upon logout.
Redirecting to Multiple Targets
You can also specify multiple redirect targets by separating them with commas:
https://phenixid.se/selfservice/authenticate/logout/?nextTarget=/selfservice/,/mfaadmin
In this case, after logout, the browser will redirect to either /selfservice/
or /mfaadmin
, depending on your application's logic.
Step-by-Step Guide to Change the Redirect URL
Prerequisites
- Access to the Configuration Manager with appropriate administrative privileges.
- Familiarity with JSON configuration files.
Instructions
Log in to Configuration Manager
Access your Configuration Manager dashboard using your administrative credentials.
Navigate to the Advanced Settings
- Click on the Advanced tab in the main navigation menu.
Access the Modules Section
- Within the Advanced settings, click on Modules to view all available modules.
Locate the Prism Root Module
- Find the prism root module associated with your web application. For this example, we will use the
selfservice
module.
- Find the prism root module associated with your web application. For this example, we will use the
Modify the Logout Redirect URL
- Add or update the
logoff_uri
parameter in the module's configuration to specify the desired redirect URL after logout.
- Add or update the
Example Configuration
Below is an example of how to configure the logoff_uri
parameter within your module's JSON configuration:
{
"name": "com.phenixidentity~phenix-prism",
"enabled": "true",
"config": {
"base_url": "/selfservice",
"auth_redirect_url": "/authenticate/selfservice",
"http_configuration_ref": "441b0aad-534e-4cad-8151-130955913c08",
"module_refs": "c18b9407-5b2a-4d53-ad48-a5ef8074bf62",
"logoff_uri": "https://server.external.com/"
},
"guide_ref": "b410d542-c99e-4021-be05-7e7eda29e3ba",
"guide_id": "guides.selfservice",
"created": "2017-07-03T14:36:44.182Z",
"id": "38b31471-436a-47ab-912f-fde88adf807e"
}
Explanation of Configuration Parameters
- name: Identifies the module.
- enabled: Indicates whether the module is active (
"true"
means enabled). - config: Contains configuration settings for the module.
- base_url: The base URL for the selfservice application.
- auth_redirect_url: The URL to redirect to after authentication.
- http_configuration_ref: Reference ID for HTTP configurations.
- module_refs: Reference IDs for related modules.
- logoff_uri: The URL where users will be redirected after logging out. Replace
"https://server.external.com/"
with your desired redirect URL.
- guide_ref and guide_id: References to guides or documentation.
- created: Timestamp of when the configuration was created.
- id: Unique identifier for the configuration.
Applying the Changes
After updating the logoff_uri
parameter:
Save the Configuration
Ensure that you save the changes within the Configuration Manager.
Test the Logout Redirect
- Log out of your application to verify that the redirection behaves as expected.
- Ensure that the new URL correctly loads and that there are no issues with the redirection process.
Troubleshooting
- Incorrect Redirect URL: Double-check the
logoff_uri
value for typos or incorrect URLs. - Multiple Redirect Targets: Ensure that multiple URLs are separated by commas without spaces and that your application logic supports handling multiple targets.