Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Bamboo tomcat url rewrite

changming su November 5, 2014

 I add url write rule successfully for JIRA and Stash. But failed for Bamboo and Confluence. It just doesn't work. Not sure why it's different for Bamboo. Can someone advise here. Thanks.

Below rule was added into urlwrite.xml as TOP RULE under WEB-INF folder

 <rule>                   

          <condition name="host" operator="notequal">host.adc.com</condition>

           <from>^/(.*)</from>

           <to type="permanent-redirect" last="true">http://host.abc.com/$1</to>

  </rule>

2 answers

1 vote
Deleted user March 9, 2015

Changes to the urlrewrite file work with JIRA and Stash, but require additional changes in the web.xml (same directory) for Confluence and Bamboo. For the latter, the web.xml contains filter mappings that will cause your UrlRewriteFilter to not be accessed.

Look for UrlRewriteFilter with the url-pattern of /s/* and remove the /s. That will cause /* to be redirected to your rewrite filter and should solve the problem.

-Todd

Roger Mejia March 20, 2018

Changming

Can you provide the details on how you got the URLRewrite filter to work for Jira, I was able to get it to work for Confluence but can't get it to for Jira. Not sure if I'm missing a line or a parameter somewhere in either the Urlrewrite.xml or web.xml files.

Thanks

Roger

Stuart King March 21, 2018

Roger,

It's important to check both web.xml files.  Assuming a default installation, one is in Program Files\Atlassian\JIRA\conf and the other is in Program Files\Atlassian\JIRA\atlassian-jira\WEB-INF.  You should check both for the pattern that Todd mentioned above.

For our URL Rewrite, we have a handful of various clauses to handle each possible way our users attempt to access the system.  It's not the prettiest but it works.  See a few example rules below:

This rule redirects the user if they just type in jira/ or if they are already using https.

<rule>
<name>Redirect Https/Shorthand</name>
<condition type="server-name" operator="notequal">^[0-9.]+$</condition>
<condition name="host" operator="notequal">jira.<ourdomain>.com</condition>
<condition type="scheme" operator="equal">https</condition>
<from>^/(.*)$</from>
<to type="redirect" qsappend="true">https://jira.<ourdomain>.com/$1</to>
</rule>

This rule validates whether or not the fully qualified domain is requested.
<rule>
<name>Domain Name Check</name>
<condition type="server-name" operator="notequal">^[0-9.]+$</condition>
<condition name="host" operator="notequal">jira.<ourdomain>.com</condition>
<condition type="scheme" operator="notequal">https</condition>
<from>^/(.*)$</from>
<to type="redirect" qsappend="true">https://jira.<ourdomain>.com/$1</to>
</rule>

This rule redirects non https requests to https ones.

<rule>
<name>FQDN NOT HTTPS</name>
<condition type="server-name" operator="notequal">^[0-9.]+$</condition>
<condition name="host" operator="equal">jira.<ourdomain>.com</condition>
<condition type="scheme" operator="notequal">https</condition>
<from>^/(.*)$</from>
<to type="redirect" qsappend="true">https://jira.<ourdomain>.com/$1</to>
</rule>

If you google tuckey URL rewrite there's some documentation available.  Note that all of these rules evaluate in sequence so each of our rules take care of an edge case.  Remember that you've reached these filters after DNS has already pointed you to the right server, so in our case we use the URL rewrite to handle improperly formatted URL's

Aside from that, we're not doing anything else.  If you could post your urlrewrite file that might help.

Regards,

Stuart

Roger Mejia March 22, 2018

Hi Stuart

Thanks for your reply....

I got it working as it turns out I had a few items in the URLRewrite.xlm file that were not right. This what I now have in the file.

<urlrewrite>
 <rule>
        <name>Domain Name Check</name>
  <condition name="host" operator="notequal">jirademo.mydomain.com</condition>
  <from>^(.*)$</from>
  <to type="redirect">http://jirademo.mydomain.com$1</to>
    </rule>
    <!-- Caching of static resources -->
   
 <class-rule class="com.atlassian.jira.plugin.webresource.CachingResourceDownloadRewriteRule"/>
   
 <!-- @since 5.0 [KickAss]-->
     <rule>
        <from>^/issues(\?.*)?$</from>
        <to type="permanent-redirect">issues/$1</to>
    </rule>
</urlrewrite>

I had to remove a few lines from the Web.xml file related to the URLRewrite filter in the Program Files\Atlassian\JIRA\atlassian-jira\WEB-INF folder. These lines are required for the Urlrewrite filter in Confluence but not for Jira.

<filter-mapping>
  <filter-name>UrlRewriteFilter</filter-name>
  <url-pattern>/*</url-pattern>
  <dispatcher>REQUEST</dispatcher>
  <dispatcher>FORWARD</dispatcher>
 </filter-mapping

 

Regards

Roger

0 votes
David Doleman May 26, 2015

I got Confluence working by doing /* for UrlRewriteFilter, but Bamboo doesn't have this line. Anything else I should check?

Also, I can't redirect HTTP to HTTPS neither wit Bamboo

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events