Bug 46665 - Regexp parsing problem in ProxyPassMatch
Summary: Regexp parsing problem in ProxyPassMatch
Status: RESOLVED WONTFIX
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_proxy (show other bugs)
Version: 2.2.11
Hardware: All All
: P2 minor (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-02-04 07:26 UTC by Gerard Chevalier
Modified: 2021-07-01 10:14 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gerard Chevalier 2009-02-04 07:26:39 UTC
I setup a proxy to a tomcat server and I have problem with the ProxyPassMatch directive.

If I write :
ProxyPassMatch ^(/.*\.page)$ ajp://hostname:8009$1
then I get the following error :
Syntax error on line 573 of C:/Program Files/Apache Software Foundation/Apache2.2/conf/httpd.conf:
ProxyPass Unable to parse URL

I noticed that it is the concatenation of hostname + port + $1 that causes trouble.
If I remove :8009 or $1, the directive can be parsed, but of course it is not what I want !

I found the following workaroud :
ProxyPassMatch ^/(.*\.page)$ ajp://hostname:8009/$1

That makes it work.

Do you confirm that the initial syntax should work ?
Comment 1 Dan Poirier 2009-02-04 08:29:04 UTC
Looking at the code, the proxy does try to parse the second parameter as a URL before ever substituting anything into it, so your workaround makes sense.

I don't know the proxy well enough to say if it's necessary for it to work that way, though.
Comment 2 Tim Funk 2009-08-26 11:55:01 UTC
I just noticed this error occurs regardless whether one is using ajp or not.

The docs for ProxyPassMatch give this reference:
^(/.*\.gif)$ http://backend.example.com$1 

But if backend.example.com is on a non-default port - you get the error "ProxyPass Unable to parse URL" - for example:

ERROR
ProxyPassMatch (/foo.+) http://backend.example.com:2829$1

But if you add a / after the port and before the regex substitution, then all is OK (as long as the regex is fixed so as no to provide an extra prefixed / )

OK
ProxyPassMatch /(foo.+) http://backend.example.com:2829/$1
Comment 3 Nick Kew 2009-08-27 01:48:32 UTC
Thanks for the report and analysis.

Fixing this would be disproportionately disruptive, so instead I'm documenting it and pointing to this bug report for explanation and workaround ideas.

Marking WONTFIX.