How do I redirect HTTP requests to HTTPS without proxy

Still need help?

The Atlassian Community is here for you.

Ask the community

NOTES

1. The solution provided in this Knowledge Base article is not supported by Atlassian because it's a customization of the product.

2. Make sure that the instance is reachable over HTTPS without any issues before proceeding.

3. In this solution, the server name is localhost, the HTTP port is 8060, and the HTTPS port is 6443

4. This was tested in Fisheye 3.7.0 and in Fisheye 4.0.3. It is not guaranteed to work in other versions.

5. Needless to say, but just in case, give this a try in a test environment before rolling out to production.

1. Edit <FISHEYE_INST>/config.xml:

<web-server>
    <http bind=":8060"/>
    <ssl truststore="/path/to/keystore.kst" 
        keystore="/path/to/keystore.kst" 
        keystore-password="OBF:19q518ce18cg1abo1abe18ce18cg19q9" 
        bind=":6443"
        truststore-password="OBF:19q518ce18cg1abo1abe18ce18cg19q9">
        <proxy-info/>
        <excludeProtocols>
            <protocol>SSLv3</protocol>
        </excludeProtocols>
    </ssl>
</web-server>

2. Edit <FISHEYE_HOME>/content/WEB-INF/web.xml:

Find the XML element below:

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

Edit url-pattern to just /*:

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

3. Edit <FISHEYE_HOME>/content/WEB-INF/urlrewrite.xml:

Add the following rule:

<rule>
    <condition type="scheme" operator="notequal">https</condition>
    <condition name="host" operator="equal">localhost:8060</condition>
    <from>^/(.*)</from>
    <to type="permanent-redirect" last="true">https://localhost:6443/$1</to>
</rule>

4. Restart the instance

After restarting the instance, whenever you try to access http://localhost:8060 you will be redirected to https://localhost:6443.

5. Document these changes

Whenever upgrading the instance, the changes in web.xml and in urlrewrite.xml are not preserved. After extracting the Zip package of the new version, make sure to revisit this page and re-do the changes.

Also, do not copy web.xml and urlrewrite.xml from the old instance over the ones in the new instance because there may be other changes in these files in the new version.

Last modified on Jul 31, 2018

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.