+49 228 5552576-0


URL Rewriting

Requires version 3.0.0 or above.

Membrane Monitor/Router can change the path URI of a request. A request to


can be rewritten to


We want to hide that this service is hosted by axis2. To do this we have to replace the part axis2 from the context path. The hostname is changed by the service proxy. To change the path URI you have to use an URL rewriting feature.

URL Rewriting Feature

To demonstrate how the rewriting works we present here the step by step description how to map the WSDL of the BLZService to a nicer URL.

Start Membrane Monitor and create a simple Service Proxy.

Creating a new Service Proxy

Figure1: Creating a new Service Proxy

Specify 2000 as the port number on which the router will listen.

Listen Port

Figure2: Listen Port

Than specify thomas-bayer.com as target host and 80 as target port. Next click on Finish.

Target Host and Port

Figure3: Target Host and Port

To add the URL rewriting feature do right click on the newly created service proxy in the Proxies View and choose edit. Then click onto the XMLConfiguration tab and have a look on it. An XML representation of the Service Proxy is displayied in the main text area of the tab.

Service Proxy XML Configuration

Figure4: Service Proxy XML Configuration Tab

add an URL Rewriting element to the Configuration XML so that your Proxy Service definition looks like.

  <serviceProxy name="" port="2000">
      <map from="^/bank/(.*)" to="/axis2/$1" />
    <target host="www.thomas-bayer.com" port="80" />
Listing 12: Service Proxy with URL Reqwriter

Click on OK button to apply changes and to save Service proxy configuration.

How it Works

After adding the rewriting feature the RewriteInterceptor is set for the rule. The interceptor will be called during the processing of each request and response.

Now take a closer look at the rewriter element:

      <map from="^/bank/(.*)" to="/axis2/$1" />
Listing 12: Service Proxy with URL Reqwriter

The interceptor is configured with one regular expression /bank/(.*) . This will match the following URIs:



In the regular expression we use a group that we can reference when replacing the URI. The value to replace the URI is given by the uri attribute and is set to /axis/$1 . The $1 is the reference to the group and will contain the value matched by the group. So the above URIs will be replaced by the following:



Test URL Rewriting

Test the monitor by opening the URL http://localhost:2000/bank/services/BLZService?wsdl in your browser. You should get the WSDL from the BLZ service.

Requesting the WSDL with a nicer URL

Figure5: Requesting the WSDL with a nicer URL

Copyright © 2008-2017 predic8 GmbH
Koblenzerstr. 65, 53173 Bonn, Tel. +49 (228) 555 25 76-0