Forum Discussion
https redirect issue with v14
After upgrading to v14 these irules mapped to https vs not working anymore.
when HTTP_REQUEST {
if { ( [string tolower [HTTP::host]] equals "www.abc.domain.com") } {
HTTP::redirect "https://abc.domain.com[HTTP::uri]"
}
if { ( [string tolower [HTTP::host]] equals "www.cbe.domain.com") } {
HTTP::respond 301 Location "https://cde.domain.com[HTTP::uri]"
}
}
- JG
Cumulonimbus
Any error messages in /var/log/ltm?
Can be there a matching iRule before this iRule?
- Sajid
Cirrostratus
var/log/ltm
Aug 9 14:06:00 lb_name err tmm[24290]: 01220001:3: TCL error: /Common/iRule_www_to_site <HTTP_REQUEST> - ERR_NOT_SUPPORTED (line 18) invoked from within "HTTP::host"
- JG
Cumulonimbus
Will you be able to share the full original irule here? The coee you have posted has syntax errors and does not have 18 lines.
- Sajid
Cirrostratus
when HTTP_REQUEST {
if { ( [string tolower [HTTP::host]] equals "www.abc.example.com") } {
HTTP::redirect "https://abc.example.com[HTTP::uri]"
}
if { ( [string tolower [HTTP::host]] equals "www.def.example.com") } {
HTTP::respond 301 Location "https://def.example.com[HTTP::uri]"
}
if { ( [string tolower [HTTP::host]] equals "www.ghi.example.com") } {
HTTP::respond 301 Location "https://ghi.example.com[HTTP::uri]"
}
if { ( [string tolower [HTTP::host]] equals "www.jkl.example.com") } {
HTTP::respond 301 Location "https://jkl.example.com[HTTP::uri]"
}
if { ( [string tolower [HTTP::host]] equals "www.mno.example.com") } {
HTTP::respond 301 Location "https://mno.example.com[HTTP::uri]"
}
if { ( [string tolower [HTTP::host]] equals "www.pqr.example.com") } {
HTTP::respond 301 Location "https://pqr.example.com[HTTP::uri]"
}
if { ( [string tolower [HTTP::host]] equals "www.stu.example.com") } {
HTTP::respond 301 Location "https://stu.example.com[HTTP::uri]"
}
if { ( [string tolower [HTTP::host]] equals "www.vwx.example.com") } {
HTTP::respond 301 Location "https://vwx.example.com[HTTP::uri]"
}
if { ( [string tolower [HTTP::host]] equals "www.yza.example.com") } {
HTTP::respond 301 Location "https://yza.example.com[HTTP::uri]"
}
if { ( [string tolower [HTTP::host]] equals "www.sas.example.com") } {
HTTP::respond 301 Location "https://sas.example.com[HTTP::uri]"
}
}
- DanS92
Cirrus
The first one would be very easy to replace with a Local Traffic Policy...
- Sajid
Cirrostratus
This logic working for me.
when HTTP_REQUEST {
switch [HTTP::host] {
"www.abc.example.com" {
HTTP::respond 301 Location "https://abc.example.com[HTTP::uri]"
log local0. "Sending request to abc.example.com"}
"www.def.example.com" {
HTTP::respond 301 Location "https://def.example.com[HTTP::uri]"
log local0. "Request redirect to def.example.com"}
}
}
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