13-Oct-2021 11:15
We have 1 read/write node and two Read-only nodes, so we want all the Get http requests to be distributed equally in them and all other requests like POST, Patch, Delete to be forwarded to read/write node
Example :-
Node1 : R/W " it will receives Get , Post,Patch,Delete "
Node2 : Read-only "it will receives Get Requests only "
Node3 : Read-only "it will receives Get Requests only "
Thank you in advance
13-Oct-2021 13:32
Hi, Ahmed.
You need to use an Irule, something like this
when HTTP_REQUEST {
if { ([string toupper [HTTP::method]] equals "POST" ) or ([string toupper [HTTP::method]] equals "PATCH" ) or ([string toupper [HTTP::method]] equals "DELETE" ) } {
node 1.1.1.1 443
}
elseif { [string toupper [HTTP::method]] equals "GET" } {
pool POOL-name
}
else {
HTTP::respond 405 content {
<html>
<head><title>HTTP Request denied</title></head>
<body>Your HTTP requests are being throttled.</body>
</html>
}
}
}
14-Oct-2021 01:27
Thank you for your reply
Kindly when i deploy this iRule it shown me an error
17-Oct-2021 00:08
Thank you i will try it 🙂
19-Oct-2021 23:40
Salam bro ,
I am trying to test the script in testing environment but it shown this error to me :-
Thank you in advance
20-Oct-2021 21:23
Hello Ahmed,
i guess there are some extra spaces between "}" and "elseif".
when HTTP_REQUEST {
if { ([string toupper [HTTP::method]] equals "POST" ) or ([string toupper [HTTP::method]] equals "PATCH" ) or ([string toupper [HTTP::method]] equals "DELETE" ) } {
node XXXXXXX XX
} elseif { [string toupper [HTTP::method]] equals "GET" } {
pool XXXXXX
} else {
HTTP::respond 405 content {
<html>
<head><title>HTTP Request denied</title></head>
<body>Your HTTP requests are being throttled.</body>
</html>
}
}
}
20-Oct-2021 23:57
Thank you it's accepted now ,
before we start the testing in virtual server setting i will need to configure http profile or http-explicit ?
21-Oct-2021 00:07
Should work with http profile.