Forum Discussion
Redirect specific url
Hallo iRule Fans
I have a problem with a iRule an hope anybody can help me.
The user logs in to the member are of the website https://website.com/Member
In the member area is a link that calls https://website.com/en/publicsearch
I need a iRule that redirects the URL form HTTPS to HTTP https://website.com/en/publicsearch to http://website.com/en/publicsearch
I have tried the irule but it doesn’t works L
when HTTP_REQUEST {
Save the url/uri so it will be available in the HTTP_RESPONSE
set uri [HTTP::uri]
}
when HTTP_RESPONSE {
if {not ($uri contains "/Member/")and([TCP::local_port] == 443)}
{
HTTP::redirect "http://$uri"
}
}
1 Reply
- Kevin_Stewart
Employee
On the port 443 VIP:
========================
when HTTP_REQUEST {
if { [string tolower [HTTP::uri]] starts_with "/en/publicsearch" } {
HTTP::redirect "http://[HTTP::host][HTTP::uri]"
}
}
========================
On the port 80 VIP:
========================
when HTTP_REQUEST {
if { [string tolower [HTTP::uri]] starts_with "/member" } {
HTTP::redirect "https://[HTTP::host][HTTP::uri]"
}
}
========================
I would also add that switching between HTTP and HTTPS can cause havoc in some browsers. It may be better to just leave everything HTTPS from the member user's perspective.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com