Bamboo tomcat url rewrite

 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

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

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

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

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

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
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Renan Battaglin
Published May 18, 2017 in Bamboo

FAQ: How to Upgrade Bamboo Server

Bamboo 5.9 will no longer be supported after June 12, 2017. What does this mean? As part of our End of Life policy, Atlassian supports major versions for two years after the first major iteratio...

1,324 views 0 5
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you