Forum Discussion
Sulabh_Srivasta
Cirrus
Jun 09, 2021iRule for GET and POST to redirect to different URLs
Hi All, I need help in setting up iRule to redirect to separate URLs for GET and POST request. I have iRule configured for GET request and working but not able to sue for POST request. GET: ...
spalande
Nacreous
Jun 09, 2021It appears, for POST request you want uri rewrite, where first uri path would be same, trimming anything after it and adding some other static URI path but not from the request itself? Also, this doesn't appear to be redirect but sending to pool (or node) on the same LTM? Please note, HTTP POST method doesn't follow a redirect.
If yes for all above, you can try the below code.
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::uri]] {
"/aa*"
{
if { [HTTP::method] eq "POST" } {
set first_uri [lindex [split [HTTP::uri] "/"] 1]
set new_uri /$first_uri/YY/ZZ
HTTP::uri $new_uri
pool p_10008
} else {
pool x_10004
}
}
default {
return
}
}
}
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects
