Forum Discussion
Need help with an iRule for HTTP Methods
Could you please review the below iRule and suggest?
when HTTP_REQUEST {
if { ( [HTTP::method] equals "PUT" ) } {
switch -glob [string tolower [HTTP::uri]] {
"/rws/api/v1/devices/*" -
"/rws/api/v1/accounts/*" {
pool POOL_POD1_RWSDEVICE
}
}
}
else
{ ( [HTTP::method] equals "POST" ) } {
switch -glob [string tolower [HTTP::uri]] {
"/rws/api/v1/accounts/*" {
pool POOL_POD1_RWSDEVICE
}
default {
pool POOL_POD1_RWS
}
}
}
}
- ThiyaguCirrus
when HTTP_REQUEST {
if { ( [HTTP::method] equals "PUT" ) } {
switch -glob [string tolower [HTTP::uri]] {
"/x/*" -
"/y/*" {
pool PUT_X_Y
}
}
}
elseif
{ ( [HTTP::method] equals "POST" ) } {
switch -glob [string tolower [HTTP::uri]] {
"/x/*" {
pool POST
}
}
}
default {
pool POOL1
}
} You should copy these iRules as is.
First iRulewhen HTTP_REQUEST priority 500 { set URI [string tolower [HTTP::uri]] if { ( [HTTP::method] == "PUT" ) } { switch -- -glob ${URI} { "/rws/api/v1/devices/*" - "/rws/api/v1/accounts/*" { pool POOL_POD1_RWSDEVICE } } } elseif { ( [HTTP::method] == "POST" ) } { switch -- -glob ${URI} { "/rws/api/v1/accounts/*" { pool POOL_POD1_RWSDEVICE } default { pool POOL_POD1_RWS } } } }
Second iRule
when HTTP_REQUEST priority 500 { if { ( [HTTP::method] == "PUT" ) } { switch -- -glob ${URI} { "/x/*" - "/y/*" { pool PUT_X_Y } } } elseif { ( [HTTP::method] == "POST" ) } { switch -- -glob ${URI} { "/x/*" { pool POST } } } default { pool POOL1 } }
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