Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

How to test external rest api?

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 ?


2 answers

0 votes

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. - example to do this with Nginx. Adjust as necessary for your specific environment.



0 votes
Andy Heinzer Atlassian Team Feb 09, 2018

I presume you are probably following this guide:

I believe there is a way you can see if these REST API calls are being diverted as expected.  Try these steps:

  1. Login directly to the specific node that you want to divert this traffic to. (in order to do this, you might need to make sure this node has a separate connector that bypasses your load balancer.  One way is to follow the steps in How to bypass a Proxy and SSL to test network connectivity.  And then connect to this node over that local address/port number, such as hostname:9999 instead of the address of your load balancer such as .)
  2. Sign in as a Jira admin, and navigate to Gear Icon -> System -> Security -> User Sessions. (This page shows you all the user sessions connected to this node)  You can also reach this by going to [hostname:portnumber]/secure/admin/CurrentUsersList.jspa
  3. Try then to open a command prompt / terminal session
  4. Use a utility like curl to make a REST call directly, example command such as:
    curl -D- -u username:password -X GET -H "Content-Type: application/json"
  5. Check the page on step 2.

If this is working that node will indicate that there is a specific rest call being made to this node.   Since this call did not request the login.jsp page, we know this call is not be originated by a web login to Jira.  In this case, when you make a curl call, it is purely a REST request to Jira datacenter.   We should see that specific node identifying this as a type=rest with the username you defined in the curl call, and the ip address this originated from.  Example screenshot below.


If you don't see this specific call, you might want to login to the other nodes in a similar manner to see if you can track down this specific call to see which node it was directed to.


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"


{ $referrer_host equals "" and [string tolower [HTTP::uri]] contains "/rest/" }

pool JIRA-test-pool


{ not $referrer_host equals "" and [string tolower [HTTP::uri]] contains "/rest/" }



{ [string tolower [HTTP::uri]] equals "/login.jsp" }


{ pool JIRA-test-pool }


{ pool JIRA-test-external-pool }

pool JIRA-test-pool


I implemented this irule. But still I can't see anything in the access-log 

Suggest an answer

Log in or Sign up to answer

Atlassian Community Events