In addition, other allowed targets can be configured.}}
extern val proxyPass : no_spaces -> proxy_target -> [Vhost];
-extern val proxyPassReverse : no_spaces -> proxy_target -> [Vhost];
-{{Interface to Apache <tt>ProxyPass</tt> and <tt>LocalProxyPass</tt>}}
+extern val proxyPassReverse : no_spaces -> proxy_reverse_target -> [Vhost];
+{{Interface to Apache <tt>ProxyPass</tt> and <tt>ProxyPassReverse</tt>}}
Env.int
(fn n => n > 1024)
+fun validProxyTarget default s =
+ case String.fields (fn ch => ch = #":") s of
+ "http" :: host :: rest =>
+ let
+ val rest = String.concatWith ":" rest
+ in
+ if List.exists (fn h' => host = h') (map (fn h => String.concat ["//", h]) Config.Apache.proxyHosts)
+ then
+ CharVector.all (fn ch => Char.isPrint ch andalso not (Char.isSpace ch)
+ andalso ch <> #"\"" andalso ch <> #"'") rest
+ andalso case String.fields (fn ch => ch = #"/") rest of
+ port :: _ =>
+ (case Int.fromString port of
+ NONE => default s
+ | SOME n => n > 1024 orelse default s)
+ | _ => default s
+ else
+ default s
+ end
+ | _ => default s
+
val _ = Env.type_one "proxy_target"
Env.string
- (fn s =>
- let
- fun default () = List.exists (fn s' => s = s') Config.Apache.proxyTargets
- in
- case String.fields (fn ch => ch = #":") s of
- "http" :: host :: rest =>
- let
- val rest = String.concatWith ":" rest
- in
- if List.exists (fn h' => host = h') (map (fn h => String.concat ["//", h]) Config.Apache.proxyHosts)
- then
- CharVector.all (fn ch => Char.isPrint ch andalso not (Char.isSpace ch)
- andalso ch <> #"\"" andalso ch <> #"'") rest
- andalso case String.fields (fn ch => ch = #"/") rest of
- port :: _ =>
- (case Int.fromString port of
- NONE => default ()
- | SOME n => n > 1024 orelse default ())
- | _ => default ()
- else
- default ()
- end
- | _ => default ()
- end)
+ (validProxyTarget (fn s => List.exists (fn s' => s = s') (Config.Apache.proxyTargets @ ["!"])))
+
+val _ = Env.type_one "proxy_reverse_target"
+ Env.string
+ (validProxyTarget (fn s => List.exists (fn s' => s = s') Config.Apache.proxyTargets))
val _ = Env.type_one "rewrite_arg"
Env.string