|Summary:||Confusing error with .htaccess rewrite to proxy when mod_proxy not active.|
|Product:||Apache httpd-2||Reporter:||Michael Streeter <mstreeter1>|
|Component:||mod_rewrite||Assignee:||Apache HTTPD Bugs Mailing List <bugs>|
Description Michael Streeter 2014-03-14 18:08:08 UTC
Created attachment 31387 [details] Patch File When a rewrite to proxy is configured in the server config, a check is made to make sure mod_proxy is active. But the same is not done if a rewrite to proxy is configured in an .htaccess file. This can produce a misleading error. Steps to Reproduce: 1) Disabe mod_proxy. 2) Add a RewriteRule to an .htaccess file that uses mod_proxy (i.e.): RewriteRule . http://www.mydom.com/index.html [P,L] 3) Go to a browser and try to load the site with the .htaccess file. Actual Results: The error_log will show an error like this: [Fri Mar 14 11:53:20.226288 2014] [core:error] [pid 6449] (2)No such file or directory: [client 192.168.2.4:32811] AH00132: file permissions deny server access: proxy:http://www.mydom.com/index.html Expected Results: [Fri Mar 14 12:02:05.964263 2014] [rewrite:error] [pid 6592] [client 192.168.2.4:32816] AH00669: attempt to make remote request from mod_rewrite without proxy enabled: proxy:http://www.mydom.com/index.html I believe this same issue would be on all hardware/operating systems, but in case it matters, this was tested on: CentOS 6.5 x86_64, Apache 2.4.7, apr-1.5.0, apr-util-1.5.3. The attached patch file for the 2.4.7 version of mod_rewrite.c fixes it for me. Basically it is the block of code from hook_uri2file that does the proxy check, copied to hook_fixup.
Comment 1 Christophe JAILLET 2018-08-22 22:00:16 UTC
Applied on trunk in r1838684. I've just changed the APLOGNO to avoid a duplicate. Thx for the patch.
Comment 2 Luca Toscano 2018-10-23 10:57:11 UTC
Christophe, is this change worth a backport proposal to 2.4.x?
Comment 3 Christophe JAILLET 2018-10-23 17:18:30 UTC
Yes I think so. Avoiding a misleading diagnostic is always a good thing. I don't remind clearly, but I'm 99% sure that I've tested the behavior before applying the patch. Will have to retest to be sure. But you can already propose for backport.