Hello all,

I had some time during the last few days to do root cause analysis on httpd bug 55315.
- "error in ProxyPass URL parsing with interpolation"
- https://issues.apache.org/bugzilla/show_bug.cgi?id=55315

This bug was described as a regression in Apache httpd 2.2.25.
But it is actually a regression in APR-util 1.5.2 as a result of the fix for APR-util bug 52479.
- apr_uri_parse("@localhost::8080") reports "@localhost" for the scheme
- https://issues.apache.org/bugzilla/show_bug.cgi?id=52479

I submitted a quick fix patch against bug 55315.
But it is probably not the ultimate fix.

The bug report lists the following set of directives:

     ProxyPassInterpolateEnv On
     RewriteEngine On

     RewriteCond %{HTTPS} =off
     RewriteRule . - [E=protocol:http]
     RewriteCond %{HTTPS} =on
     RewriteRule . - [E=protocol:https]

     ProxyPass /my_app/ ${protocol}://1.2.3.4/my_app/ interpolate
     ProxyPassReverse /my_app/ ${protocol}://1.2.3.4/my_app/ interpolate

These directives successfully allow proxies over to the target server in httpd 
2.2.22.
But they result in the following error on httpd 2.2.25:

- $ bin/httpd -X
Syntax error on line 202 of /home/mrumph/apache225/conf/httpd.conf:
ProxyPass Unable to parse URL

The ProxyPass directive is processed by the add_pass_noregex function in 
mod_proxy.c.
This calls add_pass which calls ap_proxy_add_worker in proxy_util.c.
ap_proxy_add_worker passes an uninterpolated URL to apr_uri_parse() in 
apr-util/uri/apr_uri.c.
This is true for both httpd 2.2.22 and httpd 2.2.25.

As a result of the fix for bug 52479,
apr_uri_parse no longer allows the interpolation characters (${}) to pass 
through cleanly.

The patch I submitted will allow the characters to pass through.

But perhaps it is not correct for mod_proxy to be passing uninterpolated URLs 
to apr_uri to begin with.
Perhaps the mod_proxy interpolation code should be structured differently.

mod_proxy.c does have a proxy_interpolate function,
but this is only called later through the fixups and translate_name hooks.

Any suggestions?

Thanks,

Mike Rumph




Reply via email to