Yes, Traffic Router source code doesn’t need change. To make PATH_PREFIX work 
correctly, the configuration for Traffic Router needs change.

For example, if the HOST_REGEX is ".*\.sports\..*", the Traffic Router 
configuration file “cr-config.json” will contains:

         "matchlist": [{
           "regex": ".*\\.sports\\..*",
           "match-type": "HOST"
         }] 

If a path_prefix “/path/” is added, the above item will be changed to:

          "matchlist": [
            {
              "regex": ".*\\.sports\\..*",
              "match-type": "HOST"
            },
            {
              "regex": "^/path/.*",
              "match-type": "PATH"
            }
          ]

So, with this configuration Traffic Router will not redirect the request whose 
path prefix is not “/path/”.

As the solution with PATH_REGEXP and regex_remap, there is no issue for traffic 
router, but there is problem for ATS.

The ATS remap.config file does not support regex directly, only supports path 
prefixes. So, the PATH_REGEXP can't be used as a remap rule in remap.config 
directly. To work with PATH_REGEXP, a possible way is using the remap plugin. 
But there are some issues for this, such as:

* if two delivery services with same domain name, the remap config file will 
look like:

        map http://traffic-server.sports.ipcdn.com/     
http://origin.server.com/ @plugin=regex_remap.so 
@pparam=regex_remap_ds_1.config …
        map http://traffic-server.sports.ipcdn.com/    
http://origin.server.com/ @plugin=regex_remap.so 
@pparam=regex_remap_ds_2.config …

ATS doesn’t work with this kind of remap config file.

* If implemented by regex_remap, a regex expression will be generated for a 
delivery service. The user also can configure "Regex remap expression" for a 
delivery service. If user also configure a regex expression, they may interfere 
with each other.

Thanks,
Jifeng


On 01/12/2016, 23:23, "Jan van Doorn" <j...@knutsel.com> wrote:

    So for your example you would enter 2 delvieryservices with the same 
host_regex (which would be possible because you drop the unique requirement on 
it), different path prefixes and have different settings for each? 
    
    I think I get that.... ?
    
    I _think_ this would work without changing Traffic Router (it just tags on 
the path in the redirect)... 3.3 in the doc says Traffic Router will be changed 
as well, but I don't see that in the PR? 
    
    Also, going back to my initial question - did you consider implementing 
this with PATH_REGEXP and regex_remap? 
    
    Rgds,
    JvD
    
    
    > On Dec 1, 2016, at 07:35, Jifeng Yang (jifyang) <jify...@cisco.com> wrote:
    > 
    > Hi JvD,
    > 
    > The difference between the two is: the former doesn’t serve the content 
under the paths other than “/vod/” and “/live/”.
    > 
    > For example, for the request 
“http://traffic-server.sports.ipcdn.com/path/file”, the former doesn’t serve it 
while the latter does serve it.
    > 
    > Regarding the use case, this is useful if:
    > 
    > Under the same domain name, the contents under some paths are set by one 
configuration and the contents under some other paths are set by another 
configuration.
    > 
    > For example,
    > 
    > Different “Regex remap expression” can be configured for 
“http://traffic-server.sports.ipcdn.com/vod/” and 
“http://traffic-server.sports.ipcdn.com/live/”.
    > 
    > Different traffic caches can be assigned for 
“http://traffic-server.sports.ipcdn.com/vod/” and 
“http://traffic-server.sports.ipcdn.com/live/”.
    > 
    > Some different configuration items become possible because separated 
delivery services.
    > 
    > Thanks,
    > Jifeng
    > 
    > 
    > On 30/11/2016, 23:23, "Jan van Doorn" <j...@knutsel.com> wrote:
    > 
    >    Hi Jifeng,
    > 
    >    I'm still confused, bear with me please. 
    > 
    >    The Google doc example has
    > 
    >    map    http://traffic-server.sports.ipcdn.com/vod/     
http://origin.server.com/vod/
    >    map    http://traffic-server.sports.ipcdn.com/live/     
http://origin.server.com/live/
    > 
    > 
    >    But, isn't that the same as 
    > 
    >    map    http://traffic-server.sports.ipcdn.com/     
http://origin.server.com/
    > 
    >    ?
    > 
    >    If you want to send the /live to RAM and the /vod to disk, they can't 
be in the same deliveryservice table entry, since all those type if things are 
set there? 
    > 
    >    Can you elaborate on the use case you are trying to solve?
    > 
    >    Rgds,
    >    JvD
    > 
    >> On Nov 30, 2016, at 04:16, Jifeng Yang (jifyang) <jify...@cisco.com> 
wrote:
    >> 
    >> Hi,
    >> 
    >> Different delivery services can be configured with different domain 
names now. In some cases, different delivery services with same domain name and 
different path prefixes are needed. These delivery services can have different 
configurations.
    >> 
    >> The problem and a solution are described in the document 
https://docs.google.com/document/d/19-TZ6ODla_vdiYqZajbpRiOpLvpbJxil1SvIm44zb-0/edit?usp=sharing.
    >> 
    >> The issue and PR for this:
    >> Issue: https://issues.apache.org/jira/browse/TC-55?jql=project%20%3D%20TC
    >> PR: https://github.com/apache/incubator-trafficcontrol/pull/108
    >> 
    >> Thanks,
    >> Jifeng
    >> 
    > 
    > 
    > 
    
    

Reply via email to