tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject [Bug 62667] New: RewriteMap not working with %{HTTP_HOST}
Date Fri, 31 Aug 2018 08:49:57 GMT

            Bug ID: 62667
           Summary: RewriteMap not working with %{HTTP_HOST}
           Product: Tomcat 9
           Version: 9.0.x
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: critical
          Priority: P2
         Component: Catalina
  Target Milestone: -----

When passing %{HTTP_HOST} as the key to a RewriteMap the lookup function only
passes the path of the page «/test/tespage» and not the host «»

The URL sent to Tomcat is:

In our example the %{HTTP_HOST} returns which is ok.

But referenced inside RewriteRule with input to map function it fails.

 RewriteMap portals org.apache.catalina.valves.rewrite.EPSMapPage
 RewriteRule .* ${portals:%{HTTP_HOST}}

The EPSMapPage is a rewrite map class we have made according to tomcat valve
documentation and we have checked that this class works correct.

So this portion of the RewriteRule ${portals:%{HTTP_HOST}} should feed in (%{HTTP_HOST}) to map portals but actually it feeds in
/test/testpage not the hostname.

 public String lookup(String key) {
  System.out.println("Key: " + key);
  return map.get(key.substring(1));
console output:
 Key: /test/testpage

When using
RewriteRule .* %{HTTP_HOST}
it works at expected And redirects to

You are receiving this mail because:
You are the assignee for the bug.
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message