Bug 57590 - loading mod_proxy_http makes rewriteRule's [proxy] assume http:// URI
Summary: loading mod_proxy_http makes rewriteRule's [proxy] assume http:// URI
Status: NEW
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_rewrite (show other bugs)
Version: 2.4.38
Hardware: PC Linux
: P5 normal with 3 votes (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-02-18 09:20 UTC by Igor Galić
Modified: 2019-04-02 21:52 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Igor Galić 2015-02-18 09:20:34 UTC
in our setup, we use mod_proxy_fcgi to talk to the php backend (fpm).
for reasons of efficiency, we do not proxy all requests to fpm, only
the ones that are either php, or not satisfiable by anything else.

this is the common scenario in which one would use FallbackResource
however, FallbackResource (as of 2.4.10) cannot be used with a proxy resource.
instead, we use mod_rewrite:

  RewriteEngine On

  RewriteRule ^/.*\.php(/.*)?$ unix:///srv/web/acme.com/logs/socket|fcgi://127.0.0.1%{DOCUMENT_ROOT}$0 [P]

  RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
  RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
  RewriteRule ^ unix:///srv/web/acme.com/logs/socket|fcgi://127.0.0.1%{DOCUMENT_ROOT}/index.php$0 [P]


and it works perfectly fine. so long as we do *not* load mod_proxy_http into the same httpd daemon. if we do, the above proxy urls will suddenly be assumed as http://. this seems… bad. and wrong.
Comment 1 Jaak Ristioja 2019-04-02 21:52:45 UTC
Still seems to occur with 2.4.38, e.g. for both

  RewriteRule ^/redirect$ unix:/path/to/socket|fcgi://localhost/redirect.php [proxy]
  RewriteRule ^/redirect2$ proxy:unix:/path/to/socket|fcgi://localhost/redirect.php [proxy]

These fail with 404 Not Found if mod_proxy_http.so is enabled, e.g.:

  The requested URL /unix:path/to/socket|fcgi://localhost/redirect.php was not found on this server.
  The requested URL /proxy:unix:path/to/socket|fcgi://localhost/redirect.php was not found on this server.