Forum Moderators: phranque

Message Too Old, No Replies

mod proxy - ProxyPass & ProxyReverse with multiple ErrorDocuments

         

andrewg 1976

12:30 am on Oct 11, 2007 (gmt 0)

10+ Year Member



Say I have the following ProxyPass/Reverse statements:


ProxyPass /error!
ProxyPass /InternalWebsite/ http://svr2/
ProxyPassReverse /InternalWebsite/ http://svr2/
ErrorDocument 502 http://svr1/error/502.html
ErrorDocument 500 http://svr1/error/500.html


ProxyPass /InternalWebsite2/ http://svr3/
ProxyPassReverse /InternalWebsite2/ http://svr3/
ErrorDocument 502 http://svr1/error/502_svr3.html
ErrorDocument 500 http://svr1/error/500_svr3.html


Configuring a "ErrorDocument 502" for each ProxyPass doesn't work, Apache only uses the second "ErrorDocument 502" if http://svr2/ or http://svr3/ is down.

Can I configure Aapache to use http://svr1/error/502.html if http://svr2/ is down and http://svr1/error/502_svr3.html if http://svr3 is down?

Thanks,
Andrew

[edited by: jdMorgan at 12:40 am (utc) on Oct. 11, 2007]
[edit reason] de-linked [/edit]

jdMorgan

12:38 am on Oct 11, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The fact that the ErrorDocument directives are typed "under" the ProxyPass directives doesn't mean anything -- It does not introduce any dependency or make the use of the ErrorDocument conditional in any way. Therefore, Apache will use the last one it finds in the file.

You might want to look into the <Directory> and/or <Location> containers (or others) which do introduce a dependency of the contained code on the container. For example, using a <Location> container means that the contained code will only be applied if the requested URL matches that specified in the <Location> directive.

Jim

andrewg 1976

3:54 am on Oct 15, 2007 (gmt 0)

10+ Year Member



Thanks - the <location> container does the trick.


<Location /InternalWebsite2>
ProxyPass http://svr3/
ProxyPassReverse http://svr3/
ErrorDocument 502 http://svr1/error/502_svr3.html
ErrorDocument 500 http://svr1/error/500_svr3.html
</Location>

jdMorgan

12:53 pm on Oct 16, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Do not use canonical URLs for ErrorDocuments! Doing so will cause a 302-Found response to the client for every error.

You should provide only a local URL-path for ErrorDocuments:


ErrorDocument 502 /502_svr3.html
ErrorDocument 500 /500_svr3.html

See the Apache ErrorDocument documentation to confirm.

Jim