Ron Barber created TS-2366:
------------------------------

             Summary: Default remap occurs if first remap plugin does NOT remap
                 Key: TS-2366
                 URL: https://issues.apache.org/jira/browse/TS-2366
             Project: Traffic Server
          Issue Type: Bug
          Components: Core
            Reporter: Ron Barber


When you have multiple remap plugins, if the first remap plugin does NOT return 
that it remapped, then the core 'forces' the default remapping to occur.  If 
the subsequent plugin parses the client request it will see the default 
remapped value rather than the client's original request.

To duplicate:
FILE remap.config:
map http://a.com/ http://b.com/b/  @plugin=conf_remap.so 
@pparam=pristine_host_hdr_disabled.config @plugin=regex_remap.so  
@pparam=regex.map  

FILE pristine_host_hdr_disabled.config:
CONFIG proxy.config.url_remap.pristine_host_hdr INT 0

FILE regex.map:
^/?$            http://c.com/c/index.html

Request:
curl -IH 'Host: a.com' http://127.0.0.1:8080/

Result:
The request will be mapped to b.com when it should be mapped to c.com.  If you 
reverse the order of the remap plugins (have regex_remap run first) then it 
works.

The code below is the issue...the XXX comment is the correct solution which 
needs to be implemented:

>From RemapPlugins.cc

  if (TSREMAP_NO_REMAP == plugin_retcode || TSREMAP_NO_REMAP_STOP == 
plugin_retcode) {
    // After running the first plugin, rewrite the request URL. This is doing 
the default rewrite rule
    // to handle the case where no plugin ever rewrites.
    //
    // XXX we could probably optimize this a bit more by keeping a flag and 
only rewriting the request URL
    // if no plugin has rewritten it already.
    if (_cur == 1) {
      Debug("url_rewrite", "plugin did not change host, port or path, copying 
from mapping rule");
      url_rewrite_remap_request(_s->url_map, _request_url);
    }
  }



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to