JIRA Tomcat URL?


When the JIRA base URL points to the PROXY URL… how to get the JIRA url for TOMCAT/App server instead of the proxy?


Have you tried injecting the com.atlassian.sal.api.web.context.HttpContext into your service/object? From there you can get the HttpRequest object which would let you recreate the url by looking at the getServerName and getServerPort.

Well, I took the HttpContext attached to the LocalThread which I think it works similarly to any other alternative like the mentioned SAL api, etc. But they return the remote user’s browser URL. That is just the problem.

Many companies use a proxy to forward those calls to the JIRA/Tomcat server on a different host which does not have configured the proxy host name, so the URL raises a 404 error.


  1. user’s browser: https://myproxy/jira (extranet). The myproxy doamin name is resolved against some DNS(A)
  2. Proxy: forwards (1) call to https://myhost/jira (intranet)
  3. The call is received by the JIRA plugin: The HttpContext returns (1) https://myproxy/jira
  4. The plugin uses the URL (1) but it fails because the JIRA host uses a different DNS(2) and myproxy is usually not configured getting a 404 HTTP Error (Not found)

Well, it is easy to resolve by including myproxy into the /etc/host file in the myhost server. But it has some drawbacks:

  1. The plugin fails and some users just uninstall it
  2. Even few network administrators are reluctant to make network configurations only because a plugin.

So the perfect solution would be get the https://myhost/jira URL from the plugin itself.

There are other good arguments for that like performance: it is better whether the plugin invokes JIRA directly rather than took an indirect way trough the proxy.

I’ll try this. Perhaps my guess is false and the HttpRequest via SAL API returns a different value than the one provided by the JIRA API for the getServerName method. I’ll back with the results…

Another item to take a look at is to take a look at the Host header on the http request. In theory if the proxy does it’s thing properly (huge if) - that should be returning the proxying http request’s host (not the original requests).