Posted Apr 11 by Edmund Clayton.

When upgrading from AppWorks Gateway 1.2.x to 16.x, you may want your users to access your configured services via the same URL as before. This article describes how to use URL rewriting to achieve this.

Last activity May 16 by Ugis Godmanis.
2066 views. 1 comment.

In AppWorks Gateway 16.x both the Gateway and the Administration Console are accessed via the root context of the Apache Tomcat installation.

This is a change from AppWorks Gateway 1.2.x, where users were taken to /webaccess from https://[appworksurl]/, from where they could access the services that were configured there, for example, Tempo Box or Tempo Social.

When upgrading to 16.x, you may want to ensure that users continue to access any configured services with the URL they used prior to the upgrade.

To do this, you can use URL rewriting to perform a URL redirect to the /content folder.

The following steps describe how to redirect your users from http://host.opentext.com to http://host.opentext.com/content by downloading and configuring a Java Web filter for the Apache Tomcat installation.

  1. Stop the Apache Tomcat service.

  2. Go to the UrlRewriteFilter web site.

  3. Click the urlrewritefilter-4.0.3.jar link in Step 1 of the Install process. To review the documentation for the Web Filter, click Documentation at the top of the page, then click the link to the 4.0 User Manual.

  4. Save the .jar file to <Tomcat_Home>/gateway/WEB-INF/lib.

  5. Add the following to the <Tomcat_Home>/gateway/WEB-INF/lib/web.xml file:

    <filter>
        <filter-name>UrlRewriteFilter</filter-name>
        <filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
        <async-supported>true</async-supported>
    </filter>
    <filter-mapping>
        <filter-name>UrlRewriteFilter</filter-name>
           <url-pattern>/*</url-pattern>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
    </filter-mapping>
    

    Note: The UrlRewriteFilter must be the first filter in the web.xml file.

  6. Create a urlrewrite.xml file in <Tomcat_Home>/gateway/WEB-INF/, with the following contents:

    <urlrewrite>
    <rule>
        <name>redirect from root</name>
        <condition name="host" operator="equal">host.opentext.com</condition>
        <from>^/$</from>
        <to type="permanent-redirect" last="true">http://host.opentext.com/content/</to>
    </rule> </urlrewrite>
    
  7. Start the Apache Tomcat service.

    Note: This configuration will redirect from http://host.opentext.com to http://host.opentext.com/content, which will mask the Gateway Administration Console. To access the console, the host's IP address, or some other alias must be entered into the browser address bar.

1 Comment

0

Hello,

When I add the filter to gateway web.xml and configure the rule as documented here or in "2.3 – Adding a URL Rewrite to AppWorks Gateway 16.2" (upgrade guide) it fixes the redirect issue from root to /content/, however, it also breaks Tempo notification functionality for gateway - new invites and test mail notification is no longer working.

There is some JAVA error in Tomcat logs, in my case it is following:

12-May-2017 14:12:00.055 WARNING [http-nio-8080-exec-6] org.glassfish.jersey.servlet.internal.ResponseWriter.suspend Attempt to put servlet request into asynchronous mode has failed. Please check your servlet configuration - all Servlet instances and Servlet filters involved in the request processing must explicitly declare support for asynchronous request processing.
 java.lang.IllegalStateException: A filter or servlet of the current chain does not support asynchronous operations.

Obviously, notification function is more important than redirect, but it would be still very good to have it in place. I believe that by altering the rewrite rule this could be fixed, however, i don't know what needs to be changed.

I've tried this in Gateway 16.1 and 16.2 and in both systems notification didn't work with filter enabled. I also tried to move the filter to different location in web.xml, moved it to the bottom as last filter, but it still didn't work.

Have you ever tested this rule to be compatible with all gateway functions? Maybe you already have correct rule configuration?

Thanks,

Ugis


Table of Contents

Your comment

To leave a comment, please sign in.