Forum Discussion
iRule 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:
https://www.abc.com/AA/BB ----> https://Node_X:10004/AA/BB
POST:
https://www.abc.com/AA/BB ----> https://Node_P:10008/AA/YY/ZZ
Any help will be greatly appreciated.
Thank you.
- spalande
Nacreous
It 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
* 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