在apache中使用ErrorDocument转发查询字符串

Alb*_*rto 2 apache ubuntu .htaccess

发生错误时,我正在尝试转发到另一台主机。我有这个,并且有效:

<VirtualHost *:80>
    ServerName test.com.
    ServerAlias test.com

    ProxyPreserveHost On
    ProxyPass / http://127.0.0.1:8080/
    ProxyPassReverse /  http://127.0.0.1:8080/

    RewriteEngine on

    ErrorDocument 503 /503/

    RewriteCond %{REQUEST_URI} ^/503/$
    RewriteRule ^(.*)$ http://other.host.com/

</VirtualHost>
Run Code Online (Sandbox Code Playgroud)

现在,当我有这个 URL:http://test.com/path/?param1=val1&param2=val2并且出现 503 错误时,我想重定向到新的 URL: http://other.host.com/path/?param1=val1&param2=val2

是否可以将/path/?param1=val1¶m2=val2转发到新主机?

我已经看到了这个这个,但这不完全是我的问题。

PS:我正在运行一个 java 应用程序,而不是一个 php 应用程序

jul*_*ulp 6

从 Apache 2.4.13 开始,ErrorDocument 也可以使用表达式,所以:

ErrorDocument 503 http://other.host.com/%{REQUEST_URI}?%{QUERY_STRING}
ProxyErrorOverride on
Run Code Online (Sandbox Code Playgroud)