问题
I'm using apache mod_proxy to forward certain requests to an IIS server and also use ProxyErrorOverride to provide a corporate style on the error pages.
However I would like to include the original servers error message in custom error pages to provide some additional information when debugging 500-errors. Right now the entire error page is replaced. According to http://httpd.apache.org/docs/2.4/mod/mod_proxy.html#proxyerroroverride this could be possible with mod_include, but I couldn't find any more details on this issue. Can someone help me or point me to the solution?
My apache config:
ProxyPreserveHost On
ProxyPass /errors !
ProxyPass / http://192.168.1.15:80/
ProxyPassReverse / http://192.168.1.15:80/
ProxyErrorOverride On
ErrorDocument 404 /errors/404.html
ErrorDocument 500 /errors/500.html
回答1:
Unfortunately it's not possible to combine the backend error response with the canned error response. The backend response is thrown away when it is to be replaced with the local error document.
The manual is desribing something quite different. When you #include a proxied resource, the SSI processor would just see the backend error response and incorporate it directly. With ProxyErrrOverride ON, it generates an SSI error.
来源:https://stackoverflow.com/questions/30487574/make-apache-mod-proxy-proxyerroroverride-include-original-page-contents-with-mod