Divert external rest api traffic to a node

Problem this snippet solves:

Divert external rest api traffic to a node

How to use this snippet:

Implement this irule in load balancer

Code :

when HTTP_REQUEST {

log local0. "New code"
set referrer_host [ URI::host [HTTP::header value Referer]]
log local0. "host: [HTTP::host]"
log local0. "uri: [HTTP::uri]"
log local0. "path: [HTTP::path]"
log local0. "Referer: $referrer_host"


if { ([HTTP::header exists "Referer"]) } {   

   if { $referrer_host eq "" } {
           set referrer_host "none"
           }

  if { !($referrer_host contains "jiratest.corp.chartercom.com") } {

log local0. "referrer is not equal to jira"
    if { ([HTTP::uri] contains "/rest/") } {
log local0. "referrer is not equal to jira and contain rest"
      pool JIRA-test-external-pool
    } else {
    pool JIRA-test-pool
    }
    
  } else {
  log local0. "referer is jira"
  pool JIRA-test-pool
  }

} else {
log local0. "Referer does not exist"
   pool JIRA-test-external-pool
 }


}
Published Feb 14, 2018
Version 1.0
No CommentsBe the first to comment