F5 irule intercept and configured JSON response question
Hi - I have a question on F5 irules. I need F5 to intercept a request to a weblogic server and respond with a JSON object. I have the following irule to perform this action. However the F5 intermittently allows some requests to pass through. During analysis, we found that the requests which passthrough has a JSESSIONID in the request header. Some more research showed that the below code intercepts the response and by this time, the JSESSIONID is already created and hence future requests from teh same session is allowed by F5.
Can we configure F5 to say intercept the request or hijack the request (instead of performing this on the response) and respond with this JSON? If yes, could anyone please modify the irule below? I am new to F5 and it would help if someone modified the irule below. Thanks in advance.
when CLIENT_ACCEPTED { UNCOMMENT the line below to ENABLE JSON Maintenance page now. set rewrite_response 1 } when HTTP_REQUEST { if { ([string tolower [HTTP::uri]] starts_with "/xxx/yyyy") && $rewrite_response==1 } { set json "{ \"error\": { \"errorType\":\"maintenanceError\", \"maintenanceError\": { \"errorCode\":\"1111\", \"errorMessage\":\"
We're Sorry
We are down.
\" } }, \"status\":false }" HTTP::respond 200 content $json "Content-Type" "application/json" unset rewrite_response return } }