summaryrefslogtreecommitdiffstats
path: root/modules/mappers/mod_rewrite.c
diff options
context:
space:
mode:
authorChristophe Jaillet <jailletc36@apache.org>2018-08-22 23:57:37 +0200
committerChristophe Jaillet <jailletc36@apache.org>2018-08-22 23:57:37 +0200
commitd8ba15241607c67b033609a5a7dddbfa13b74c5d (patch)
tree300f77efd15f72bab18a4012ac9ac48c60d23f54 /modules/mappers/mod_rewrite.c
parents/require/Require/ to help another syntax color highlight work correctly. (diff)
downloadapache2-d8ba15241607c67b033609a5a7dddbfa13b74c5d.tar.xz
apache2-d8ba15241607c67b033609a5a7dddbfa13b74c5d.zip
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.
Basically this patch is the block of code from hook_uri2file that does the proxy check, copied to hook_fixup. Patch provided by Michael Streeter [mstreeter1 gmail.com], slightly modified to use a new APLOGNO PR 56264 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1838684 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules/mappers/mod_rewrite.c')
-rw-r--r--modules/mappers/mod_rewrite.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/modules/mappers/mod_rewrite.c b/modules/mappers/mod_rewrite.c
index 2066f932c1..3970cff5a9 100644
--- a/modules/mappers/mod_rewrite.c
+++ b/modules/mappers/mod_rewrite.c
@@ -5023,6 +5023,16 @@ static int hook_fixup(request_rec *r)
if (l > 6 && strncmp(r->filename, "proxy:", 6) == 0) {
/* it should go on as an internal proxy request */
+ /* check if the proxy module is enabled, so
+ * we can actually use it!
+ */
+ if (!proxy_available) {
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(10160)
+ "attempt to make remote request from mod_rewrite "
+ "without proxy enabled: %s", r->filename);
+ return HTTP_FORBIDDEN;
+ }
+
/* make sure the QUERY_STRING and
* PATH_INFO parts get incorporated
* (r->path_info was already appended by the