Reputation: 795
I'm trying forward to another host when error occurs. I have this, and works:
<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>
Now, when I have this URL: http://test.com/path/?param1=val1¶m2=val2
and when 503 error ocurrs, I want redirect to new URL: http://other.host.com/path/?param1=val1¶m2=val2
.
It is possible forward /path/?param1=val1¶m2=val2 to new host?
I have seen this and this, but it is not exactly my problem.
PS: I'm running a java application, not a php application
Upvotes: 2
Views: 1077
Reputation: 121
Tested in shell script CGI and PHP on Apache 2.2
In shell script CGI, dump the /bin/env vars and grep REQUEST_URI
,
In PHP, ret $_SERVER['REQUEST_URI']
This tip works for keep query string from httpd.conf settings redirected.
ErrorDocument 401 /errCode/401.html
Upvotes: 0
Reputation: 4010
Since Apache 2.4.13, ErrorDocument can also use expression, so:
ErrorDocument 503 http://other.host.com/%{REQUEST_URI}?%{QUERY_STRING}
ProxyErrorOverride on
Upvotes: 6