From 8ac607eaa4ffe3b30b109057aa9a607d49b13625 Mon Sep 17 00:00:00 2001 From: Clinton Ebadi Date: Sat, 27 Apr 2019 19:13:23 -0400 Subject: [PATCH] apache: reverse host/rewrite arguments in proxyRewrite Bit awkward having the proxied server in between the match and rewrite expressions. --- lib/mod_rewrite.dtl | 7 ++++--- src/plugins/apache.sml | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/mod_rewrite.dtl b/lib/mod_rewrite.dtl index b4255dc..7e002f8 100644 --- a/lib/mod_rewrite.dtl +++ b/lib/mod_rewrite.dtl @@ -63,11 +63,12 @@ extern val rewriteBase : no_spaces -> [Location]; extern type proxy_port; {{A port number above 1024}} -extern val proxyRewrite : regexp -> proxy_reverse_target -> no_spaces -> [mod_rewrite_flag] -> [^Vhost]; +extern val proxyRewrite : regexp -> no_spaces -> proxy_reverse_target -> [mod_rewrite_flag] -> [^Vhost]; + {{Safe wrapper around mod_rewrite proxy flag. All requests matching the regular expression in the first argument are proxied to the host - specified in the second argument, appending a new URI by - substituting variables in the third argument as per Apache + specified in the third argument, appending a new URI by substituting + variables in the second argument as per Apache mod_rewrite. Additional rewrite flags may be specified.}} extern type mod_rewrite_trace_level; diff --git a/src/plugins/apache.sml b/src/plugins/apache.sml index a490419..236aa9d 100644 --- a/src/plugins/apache.sml +++ b/src/plugins/apache.sml @@ -665,8 +665,8 @@ fun checkExpires () = expiresEnabled := true) val () = Env.action_four "proxyRewrite" - ("from", Env.string, "tohost", Env.string, "to", Env.string, "flags", Env.list flag) - (fn (from, tohost, to, flags) => + ("from", Env.string, "to", Env.string, "tohost", Env.string, "flags", Env.list flag) + (fn (from, to, tohost, flags) => (checkRewrite (); write "\tRewriteRule\t\""; write from; -- 2.20.1