osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug 62864] New: ProxyPass regex destination is not recognized


https://bz.apache.org/bugzilla/show_bug.cgi?id=62864

            Bug ID: 62864
           Summary: ProxyPass regex destination is not recognized
           Product: Apache httpd-2
           Version: 2.4.37
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: mod_proxy
          Assignee: bugs@xxxxxxxxxxxxxxxx
          Reporter: alexandre.schaff@xxxxxxxxx
  Target Milestone: ---

Within method add_pass from mod_proxy.c, there is a call to "apr_fnmatch_test"
in order to determine if cmd->path is a pattern (a regex) or a prefix
(filename).

apr_fnmatch_test does not recognize "^" or "("...")" as a pattern.

The sample from https://httpd.apache.org/docs/2.4/mod/core.html#locationmatch
is thus not recognized.

A conf like :
<LocationMatch ^/(api|truc)/$>
  Require all granted
  ProxyPass http://127.0.0.1:1234/$1
  ProxyPassReverse http://127.0.0.1:1234/$1
</LocationMatch>

does not proxypass due to result from apr_fnmatch_test().

Changing regex to "^/(api|truc)/[\w]*$" changes result from apr_fnmatch_test()
and proxypass applies.

Note : apr_fnmatch_test() tests for a limited regex scope (posix's glob).

I added a new apr function : apr_fnmatch_test_regex()
new functions adds "^" and "(.*)" to be recognized as regex, it works as
expected for the given use-case, and maybe can be applied to other places (not
checked).

Dear Apache devs, what would be a better correction ?

br,
Alexandre.

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