Recently, we faced the following access_denied error:
http://<myhost>:<ohs_port>/oic_rp/return?error=access_denied&state=2441cc276a41daca872fb2eaa364e6da785b0f58
To prevent that error to be displayed to users, we wanted to redirect that URL to the WC Portal login page. As OHS was the web server, we tried different RedirectMatch instructions like the following:
RedirectMatch 301 ^/oic_rp/return?error=access_denied.*
http://<myhost>:<ohs_port>/myApp
However, the special character '?' was an issue and redirection did not work. Then we tried RewriteRule module with special characters flags (NE, B), but again, it did not work.
The solution was capturing errors instead of URL using RewriteCond. In this case:
RewriteEngine
on
RewriteOptions
Inherit
RewriteCond
%{QUERY_STRING} error=access_denied [NC]
RewriteCond
%{REQUEST_URI} ^/oic_rp/return$ [NC]
RewriteRule
^/(.*) http://<myhost>:<ohs_port>/myApp? After restarting OHS, the naughty URL was redirecting to the login page.
References:
OAM Standard Error Codes
No comments:
Post a Comment