You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@httpd.apache.org by bu...@apache.org on 2024/08/05 09:46:01 UTC
[Bug 69241] New: balancer URL mangled after rewrite in 2.4.62+
https://bz.apache.org/bugzilla/show_bug.cgi?id=69241
Bug ID: 69241
Summary: balancer URL mangled after rewrite in 2.4.62+
Product: Apache httpd-2
Version: 2.4.62
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P2
Component: mod_proxy_balancer
Assignee: bugs@httpd.apache.org
Reporter: dzambonini@names.co.uk
Target Milestone: ---
Given a simple RewriteRule of:
RewriteRule ^ http://10.0.0.1/?domain=%{HTTP_HOST} [P,END]
For a request with a Host: header of:
Host: unlikely-to-exist.com
..
The remote end sees:
"GET /?domain=unlikely-to-exist.com HTTP/1.1"
as expected. However, if the url is made a balancer:
<Proxy "balancer://forwarders">
BalancerMember "http://10.0.0.1:80" retry=60
keepalive=On ttl=60 smax=3 max=10
BalancerMember "http://10.0.0.2:80" retry=60
keepalive=On ttl=60 smax=3 max=10
BalancerMember "http://10.0.0.3:80" retry=60
keepalive=On ttl=60 smax=3 max=10
ProxySet lbmethod=bybusyness timeout=3 failontimeout=On
</Proxy>
RewriteRule ^ balancer://members/?domain=%{HTTP_HOST} [P,END]
The remote end now sees:
"GET /%3Fdomain=unlikely-to-exist.com?domain=unlikely-to-exist.com HTTP/1.1"
which is obviously mangled, where it worked prior to 2.4.62. I understand there
are ongoing changes related to addressing %3F encoding security issues, but I
don't think this particular behaviour has been reported anywhere before.
Attempting to patch for, say, PR69197 does not improve matters, and a suggested
fix for PR69235 also breaks the non-balanced case.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org
[Bug 69241] balancer URL mangled after rewrite in 2.4.62+
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=69241
--- Comment #5 from Dave <dz...@names.co.uk> ---
(In reply to Ruediger Pluem from comment #4)
> (In reply to Dave from comment #3)
> > I hope you don't mind, but I applied the proposed PR69260 patch to (trunk)
> > mod_rewrite to test, as PR 69235/69241/69259/69260 look related?
> >
> > The behaviour is odd - trunk mod_rewrite exhibits the same behaviour as the
> > 2.4.62 release; with this patch, it fixes for the balancer:// rewrite both
> > inside and outside of Directory context, but instead now breaks for a direct
> > http:// URI rewrite inside (but not outside) of Directory context (the path
> > is lost, it just requests /).
>
> Have you tried taking the 2.4.62 mod_rewrite.c source and applying the
> patches from PR 69235 and 69260, namely
> https://bz.apache.org/bugzilla/attachment.cgi?id=39832 and
> https://bz.apache.org/bugzilla/attachment.cgi?id=39842 ?
I've just tried this, and great! It passes the 4 simple test cases (http:// and
balancer:// both inside and outside of Directory context)
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org
[Bug 69241] balancer URL mangled after rewrite in 2.4.62+
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=69241
--- Comment #4 from Ruediger Pluem <rp...@apache.org> ---
(In reply to Dave from comment #3)
> I hope you don't mind, but I applied the proposed PR69260 patch to (trunk)
> mod_rewrite to test, as PR 69235/69241/69259/69260 look related?
>
> The behaviour is odd - trunk mod_rewrite exhibits the same behaviour as the
> 2.4.62 release; with this patch, it fixes for the balancer:// rewrite both
> inside and outside of Directory context, but instead now breaks for a direct
> http:// URI rewrite inside (but not outside) of Directory context (the path
> is lost, it just requests /).
Have you tried taking the 2.4.62 mod_rewrite.c source and applying the patches
from PR 69235 and 69260, namely
https://bz.apache.org/bugzilla/attachment.cgi?id=39832 and
https://bz.apache.org/bugzilla/attachment.cgi?id=39842 ?
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org
[Bug 69241] balancer URL mangled after rewrite in 2.4.62+
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=69241
--- Comment #3 from Dave <dz...@names.co.uk> ---
I hope you don't mind, but I applied the proposed PR69260 patch to (trunk)
mod_rewrite to test, as PR 69235/69241/69259/69260 look related?
The behaviour is odd - trunk mod_rewrite exhibits the same behaviour as the
2.4.62 release; with this patch, it fixes for the balancer:// rewrite both
inside and outside of Directory context, but instead now breaks for a direct
http:// URI rewrite inside (but not outside) of Directory context (the path is
lost, it just requests /).
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org
[Bug 69241] balancer URL mangled after rewrite in 2.4.62+
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=69241
Dave <dz...@names.co.uk> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEEDINFO |NEW
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org
[Bug 69241] balancer URL mangled after rewrite in 2.4.62+
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=69241
--- Comment #6 from Eric Covener <co...@gmail.com> ---
(In reply to Dave from comment #5)
> (In reply to Ruediger Pluem from comment #4)
> > (In reply to Dave from comment #3)
> > > I hope you don't mind, but I applied the proposed PR69260 patch to (trunk)
> > > mod_rewrite to test, as PR 69235/69241/69259/69260 look related?
> > >
> > > The behaviour is odd - trunk mod_rewrite exhibits the same behaviour as the
> > > 2.4.62 release; with this patch, it fixes for the balancer:// rewrite both
> > > inside and outside of Directory context, but instead now breaks for a direct
> > > http:// URI rewrite inside (but not outside) of Directory context (the path
> > > is lost, it just requests /).
> >
> > Have you tried taking the 2.4.62 mod_rewrite.c source and applying the
> > patches from PR 69235 and 69260, namely
> > https://bz.apache.org/bugzilla/attachment.cgi?id=39832 and
> > https://bz.apache.org/bugzilla/attachment.cgi?id=39842 ?
>
> I've just tried this, and great! It passes the 4 simple test cases (http://
> and balancer:// both inside and outside of Directory context)
Thanks for the quick testing!
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org
[Bug 69241] balancer URL mangled after rewrite in 2.4.62+
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=69241
--- Comment #7 from Dave <dz...@names.co.uk> ---
I've just been looking over this and think I should make clear that the fix
worked against the trunk mod_rewrite.c at that time, and not the 2.4.62 release
mod_rewrite.c (mod_rewrite.h not updated to retain same API versioning) due to
one of the patches not applying to 2.4.62.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org
[Bug 69241] balancer URL mangled after rewrite in 2.4.62+
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=69241
abernal <ab...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
--- Comment #8 from abernal <ab...@apache.org> ---
Verified: both fixes referenced in comment 5/6 landed on trunk the same day
they were tested here - r1920570 (c9dc4bb61b, "mod_proxy to canonicalize
rewritten [P] URLs. PR 69235.") and r1920571 (4348e8cb7d, follow-up moving
escaping/r->args handling to mod_proxy). Both are still present in current
trunk. Dave confirmed in comment 5 this combination passes all 4 test cases
(http:// and balancer://, inside and outside Directory context).
Note: unlike some other closed-on-trunk PRs, I don't see a 2.4.x backport
proposal for these two revisions in STATUS yet, so that may still be worth
proposing separately. But the underlying bug this PR tracks is fixed on trunk,
so closing here.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org
[Bug 69241] balancer URL mangled after rewrite in 2.4.62+
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=69241
Ruediger Pluem <rp...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |NEEDINFO
--- Comment #1 from Ruediger Pluem <rp...@apache.org> ---
Unfortunately I cannot reproduce the below issue with 2.4.62 and the following
minimal configuration:
ServerRoot "/usr/src/apache/apache_2.4.62"
Listen 9090
LoadModule mpm_event_module modules/mod_mpm_event.so
LoadModule authz_core_module modules/mod_authz_core.so
LoadModule mime_module modules/mod_mime.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule env_module modules/mod_env.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule slotmem_shm_module modules/mod_slotmem_shm.so
LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so
LoadModule lbmethod_bytraffic_module modules/mod_lbmethod_bytraffic.so
LoadModule lbmethod_bybusyness_module modules/mod_lbmethod_bybusyness.so
LoadModule lbmethod_heartbeat_module modules/mod_lbmethod_heartbeat.so
LoadModule unixd_module modules/mod_unixd.so
LoadModule dir_module modules/mod_dir.so
LoadModule alias_module modules/mod_alias.so
LoadModule rewrite_module modules/mod_rewrite.so
User daemon
Group daemon
DocumentRoot "/usr/src/apache/apache_2.4.62/htdocs"
<Directory "/usr/src/apache/apache_2.4.62/htdocs">
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
ErrorLog "logs/error_log"
LogLevel warn
LogFormat "%h %l %u %t \"%r\" %>s %b" common
CustomLog "logs/access_log" common
RewriteEngine On
RewriteRule ^ balancer://forwarders/?domain=%{HTTP_HOST} [P,END]
<Proxy balancer://forwarders>
Balancermember http://127.0.0.1:9998
Balancermember http://127.0.0.1:9999
</Proxy>
Do I miss something in my configuration? What happens if you use the above
configuration? Do things work correctly then?
--- Comment #2 from Dave <dz...@names.co.uk> ---
Apologies spending some time getting back to you over this, my local buildsys
was broken due to a metadata issue. I can confirm that under my setup your
config works; however wrapping the Rewrite rules in a <Directory> causes it to
fail (/var/www/html in my case):
<Directory /usr/src/apache/apache_2.4.62/htdocs>
RewriteEngine On
RewriteRule ^ balancer://forwarders/?domain=%{HTTP_HOST} [P,END]
</Directory>
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org
[Bug 69241] balancer URL mangled after rewrite in 2.4.62+
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=69241
Markus Wollny <ma...@gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |markus.wollny@gmail.com
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org