Forum Discussion
ken_ucs
Jun 10, 2014Nimbostratus
Error log "operation not supported....." when applied secondary irule to VS
I have applied the first irule "HTTPS_retry_prod" and it was working fine. During the maintenance, I applied the secondary irule "isolation_redirect" to redirect all user to the announcement page exc...
ken_ucs
Jun 10, 2014Nimbostratus
Hi Patrik , Thanks for reminding ! Below is the irule.
HTTPS_retry_prod
when CLIENT_ACCEPTED {
Save the name of the virtual server default pool
set def_pool [LB::server pool]
On each new TCP connection track that we have not retried a request yet
set max_retries [active_members $def_pool]
set retries 0
}
when HTTP_REQUEST {
Only save the request headers if this is not a retried request
if { $retries == 0 } {
set request_headers [HTTP::request]
if { [HTTP::method] eq "POST" } {
Trigger collection for up to 1MB of data
if { [HTTP::header "Content-Length"] ne "" && [HTTP::header "Content-Length"] <= 1048576 } {
set content_length [HTTP::header "Content-Length"]
} else {
set content_length 1048576
}
Check if $content_length is not set to 0
if { $content_length > 0 } {
HTTP::collect $content_length
}
}
}
}
when HTTP_REQUEST_DATA {
do stuff with the payload
set payload [HTTP::payload]
Append HTTP payload to HTTP request header to form a complete HTTP post request (request + payload)
append request_headers [HTTP::payload [HTTP::payload length]]
}
when LB_SELECTED {
Select a new pool member from the VS default pool if we are retrying this request
if { $retries > 0 } {
+ log selected member when retry
log local0. "Retry selected : server=[IP::server_addr] client=[IP::client_addr]"
LB::reselect pool $def_pool
}
}
when LB_FAILED {
log local0. "LB fail : server=[IP::server_addr] client=[IP::client_addr]"
LB::reselect pool $def_pool
}
when HTTP_RESPONSE {
Check for server errors
if { [HTTP::status] >= 500 } {
Server error, retry the request if we have not already retried more times than there are pool members
incr retries
log local0. "Response error : server=[IP::server_addr] client=[IP::client_addr] retry=$retries max_retries=$max_retries"
if { $retries < $max_retries } {
log retry header
log local0. "HTTP retry : server=[IP::server_addr] client=[IP::client_addr] header=[substr $request_headers 0 '?']"
HTTP::retry $request_headers
Exit this event from this iRule so we do not reset retries to 0
return
}
+ retry reach maximum no. of time, log the event
log local0. "Retry maximum : server=[IP::server_addr] client=[IP::client_addr] max_retries=$max_retries"
}
If we are still in the rule we are not retrying this request
set retries 0
}
isolation_redirect
when HTTP_REQUEST {
if { [class match [IP::client_addr] equals "lms_support_data_group"] } {
log local0. "Client [IP::client_addr] allowed"
} else {
HTTP::redirect "http://www.polyu.edu.hk/elearning/announcement/"
log local0. "Client [IP::client_addr] isn't allowed , Action redirect"
}
}
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