Jira servlet uses wrong base URL

Hi

I am currently facing the following problem:
I developed a Jira plugin containing a servlet module locally.
The local Jira installation uses a base URL in the format “hostname/jira”.

Now I installed the plugin on our Jira Server.
The base URL of this Jira installation is in a different format without the “/jira”, so Jira is accessible by only entering hostname:port.

Now whenever I try to use the servlet it uses a base URL containing “/jira” which obviously leads nowhere (404 error).

I know that I could change the base URL of the Jira installation and add the “/jira” part but I would prefer to change the base URL that the servlet uses.

Therefore my question is:
Where can I change the base URL the servlet uses?

There are actually several ways to get the baseUrl. Given that you are in a servlet, you should be able to get the HttpRequest object. This should have a contextPath() method which will return the /jira part of the baseUrl.

Jira also allows users to set the Jira base URL as part of the application setup process. There are several ways to retrieve this property, as mentioned in the following topics:

2 Likes

Hi remie

Thanks for your reply which guided me in the right direction.

1 Like