Uploaded image for project: 'Traffic Server'
  1. Traffic Server
  2. TS-3120

Overlapping rank in config.remap when using .include directives

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.0.0
    • Fix Version/s: 5.2.0
    • Component/s: Configuration, Core
    • Labels:
      None

      Description

      As described in docs

      Once these rules are executed we pick the lowest line number as the match (which replicates first-match-wins).

      In fact, we use line number for rank for now. (Github)

      However, when we use .include directives to include some other remap config files, there will be overlapping and conflict with the line numbers in each other file.

      Examples
      remap.config

      .include remap1.config
      .include remap2.config
      

      remap1.config

      map /foo/ https://www.yahoo.com
      

      remap2.config

      map /foo/bar1 https://www.yahoo.com
      map /foo/bar2 https://www.yahoo.com
      

      Test Results

      $ curl "`hostname`/foo/" -I | grep HTTP
      HTTP/1.1 200 OK
      $ curl "`hostname`/foo/bar1" -I | grep HTTP
      HTTP/1.1 200 OK
      $ curl "`hostname`/foo/bar2" -I | grep HTTP
      HTTP/1.1 404 Not Found
      

      When parsing remap1.config, first entry in remap1.config is inserted with rank 0, second with rank 1. Then parsing remap2.config, the single entry is inserted with rank 0 again. So the entry in remap2.config is overlapped with first entry in remap1.config and takes precedence with second entry. This would confuse customers.

      I'm considering using a global line number to count each entry, and follow the "first-match-wins" rules. I test with my local environment and it works. However, we are using the line number for debugging output(Github), so the current count variant cln is still needed. This would mess up the code. Appreciate for any suggestions to this issue.

        Attachments

        1. TS-3120.diff
          2 kB
          Feifei Cai
        2. TS-3120_fix_regex.diff
          0.7 kB
          Feifei Cai

          Activity

            People

            • Assignee:
              jamespeach James Peach
              Reporter:
              ffcai Feifei Cai
            • Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: