Forum Discussion
[iRules]redirect to other site or pool
Hi, I'm trying redirect by host name.
When the access http://aaa.com, redirect to https://bbb.com When the access https://bbb.com, just through to pool related to VS bbb.com.
I set like below, but error has appeared 01070151:3: Rule [/Common/redirect_irule name] error: /Common/redirect_irule name:5: error: [undefined procedure: elseif][elseif { [HTTP::host] equals bbb.com }{ pool bbb.com }] ''
How I should correct?
when HTTP_REQUEST { if { [HTTP::host] equals "aaa.com" }{ redirect "https://bbb.com[HTTP::uri]" } elseif { [HTTP::host] equals "bbb.com" }{ pool bbb.com } }
- jaikumar_f5
Noctilucent
Hi Tyranon,
Try the below,
when HTTP_REQUEST { if { [HTTP::host] equals "aaa.com" } { HTTP::redirect "https://bbb.com[HTTP::uri]" } elseif { [HTTP::host] equals "bbb.com" } { pool bbb.com } }
BTW if your VS already has the default pool which is bbb.com, you dont need the elseif condition, because the host is ultimately going to be bbb.com and it would just process the traffic and send to the VS pool, so below irule can be used too,
when HTTP_REQUEST { if { [HTTP::host] equals "aaa.com" } { HTTP::redirect "https://bbb.com[HTTP::uri]" } }
- jaikumar_f5
Noctilucent
Hi Tyranon,
Try the below,
when HTTP_REQUEST { if { [HTTP::host] equals "aaa.com" } { HTTP::redirect "https://bbb.com[HTTP::uri]" } elseif { [HTTP::host] equals "bbb.com" } { pool bbb.com } }
BTW if your VS already has the default pool which is bbb.com, you dont need the elseif condition, because the host is ultimately going to be bbb.com and it would just process the traffic and send to the VS pool, so below irule can be used too,
when HTTP_REQUEST { if { [HTTP::host] equals "aaa.com" } { HTTP::redirect "https://bbb.com[HTTP::uri]" } }
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