module/apache: fix 404 from reverse proxy
When Gerrit expands diff files in reviews, it requests URI with encoded
slashes. Apache mod_rewrite can redirect to a reverse proxy with [P], but
it doesn't allow encoded slashes causing Gerrit to fail with 404. Fix this
using the ProxyReverse directive instead of RewriteRule.
diff --git a/module/apache/scheme.sh b/module/apache/scheme.sh
index a9eb412..ed02ad6 100644
--- a/module/apache/scheme.sh
+++ b/module/apache/scheme.sh
@@ -194,11 +194,13 @@
ProxyRequests off
ProxyPreserveHost on
ProxyErrorOverride on
-
AllowEncodedSlashes on
- RewriteEngine on
+
# Proxy incoming requests towards Gerrit Code Review
- RewriteRule ^(/?)(.*)$ ${_GERRIT_PROXY_PROTOCOL_}://${_GERRIT_DKRC_FRONTEND_IP_}:${_GERRIT_PROXY_PORT_}/gerrit/\$2 [NE,P]
+ ProxyPassMatch \\
+ ^/(.*)$ ${_GERRIT_PROXY_PROTOCOL_}://${_GERRIT_DKRC_FRONTEND_IP_}:${_GERRIT_PROXY_PORT_}/gerrit/\$1 nocanon
+ ProxyPassReverse \\
+ ^/(.*)$ ${_GERRIT_PROXY_PROTOCOL_}://${_GERRIT_DKRC_FRONTEND_IP_}:${_GERRIT_PROXY_PORT_}/gerrit/\$1
<LocationMatch \"(/gerrit/login(/?)|/login(/?))\">