Hi all,
I wrote a irule to divert all external rest api traffic to a particular node. But, dont know how to test it. Can someone please help me with that ?
when HTTP_REQUEST {
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. "referrer: $referrer_host"
log local0. "referrer: referrer_host"
if
{ $referrer_host equals "jiratest.corp.chartercom.com" and [string tolower [HTTP::uri]] contains "/rest/" }
{
pool JIRA-test-pool
}
if
{ not $referrer_host equals "jiratest.corp.chartercom.com" and [string tolower [HTTP::uri]] contains "/rest/" }
{
if
{ [string tolower [HTTP::uri]] equals "/login.jsp" }
{ pool JIRA-test-pool }
else
{ pool JIRA-test-external-pool }
}
pool JIRA-test-pool
}
I implemented this irule. But still I can't see anything in the access-log
Working with apps behind load balancers before, I've found it helpful when the server has added a small HTTP header that indicates the node it's coming from. For security reasons you may not want to make it as simple as 1,2,3,4 - but maybe obfuscate it a little bit and use a random string that your team knows what node is processing the request. This means you can view it in the browser itself instead of logging in to the node(s) to see what requests it's handling.
http://nginx.org/en/docs/http/ngx_http_headers_module.html - example to do this with Nginx. Adjust as necessary for your specific environment.
CCM
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.