Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-68844

Jira duplicates REST resource root path in WADL

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Medium
    • None
    • 8.0.0, 8.1.1, 8.2.1, 8.3.0, 8.2.3, 8.5.0
    • REST API

    Description

      Summary

      The application.wadl file provided by the Jira REST API duplicates the API path in both the resource base and the resource path, leading to an invalid URL.

      This also breaks integration with the Atlassian REST API Browser plugin making it provide wrong REST resource URLs.

      Steps to reproduce

      1. Log in to a Jira instance running Jira 8.0 or above
      2. Access <JIRA_URL>/rest/api/2/application.wadl (in case you are checking from the browser and you are seeing JSON instead of XML, right click and select "View page source")

      Expected result

      <ns2:resource> elements don't contain "api/2/" prefix, as it used to be in previous Jira versions (Checked Jira 7.12.0)
      e.g.

          <ns2:resources base="https://localhost:8090/rest/api/2/">
              <ns2:resource path="permissionscheme">
      

      Actual result

      <ns2:resource> elements contains "api/2/" prefix
      e.g.

          <ns2:resources base="https://localhost:8090/rest/api/2/">
              <ns2:resource path="api/2/permissionscheme">
      

      Notes

      The duplicated "api/2/" prefix breaks integration with Atlassian REST API Browser plugin making it provide wrong REST resource URLs.

      Workaround

      For applications that rely on the WADL and do not function correctly (such as the Atlassian REST API Browser) it might be possible to rewrite the URLs. The following workaround has been tested in Jira 8.2.1 with the most recent version of the Atlassian Rest API Browser:

      1. Shut down Jira, and make a backup of $jira-install/conf/server.xml
      2. Add the following to $jira-install/conf/server.xml, just before the closing </Host> tag:
        <Valve className="org.apache.catalina.valves.rewrite.RewriteValve" />
        
      1. Create a new file at $jira-install/conf/Catalina/localhost/rewrite.config with the following contents:
        RewriteRule ^/rest/api/([0-9][.]?[0-9]?)/api/[0-9][.]?[0-9]?/(.*)$ /rest/api/$1/$2
        

        Note: The path to the rewrite config file will depend on your server.xml. The folder path will be created - so you can use whatever folders have been created under $jira-install/conf.
        Note: If you're using a context path, make sure to include that in the rewrite.config file - both in the rule, and the rewrite section as well, before /rest

      1. Restart Jira

      While this workaround doesn't affect the incorrect display in the WADL file, it will ensure that any requests to the REST API will be redirected correctly to the same API; and allowing integrations using the WADL to function correctly (such as the REST API browser).

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              pczuj Przemyslaw Czuj
              Votes:
              36 Vote for this issue
              Watchers:
              53 Start watching this issue

              Dates

                Created:
                Updated: