适用于特定URL模式的Apache mod-proxy ProxyErrorOverride [英] Apache mod-proxy ProxyErrorOverride for specific URL patterns

查看:172
本文介绍了适用于特定URL模式的Apache mod-proxy ProxyErrorOverride的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将Apache 2.2与mod-proxy一起使用,并且已经用几个ProxyPass语句配置了它,以便从远程URL到本地URL进行代理.我需要为这些代理URL从Apache返回自定义错误文档,因此我在我的mod-proxy配置中将"ProxyErrorOverride On"与一些ErrorDocument指令(具有本地URL路径)一起设置为返回一些HTTP状态代码的自定义错误页面兴趣.但是,当返回未为其创建ErrorDocument指令的状态代码时,Apache会将响应正文替换为默认错误页面,而不是保留原始响应正文.这不适用于该应用程序.所以我真的有两个问题:

I am using Apache 2.2 with mod-proxy and I have configured it with several ProxyPass statements to proxy from remote URL to local URL. I need to have custom error documents returned from Apache for these proxied URLs so I set "ProxyErrorOverride On" in my mod-proxy configuration along with some ErrorDocument directives (with local URL path) to return custom error pages for a few HTTP status codes of interest. However, when a status code is returned for which I have NOT created an ErrorDocument directive for, Apache replaces the response body with a default error page instead of leaving the original response body intact. This won't work with the application. So I really have 2 questions:

1)如果没有为它定义ErrorDocument覆盖,是否可以将Apache配置为保留特定状态代码的原始响应正文?

1) Is it possible to configure Apache to leave the original response body intact for a particular status code if I don't have an ErrorDocument override defined for it?

2)是否可以将ProxyErrorOverride指令仅应用于我的ProxyPass语句中的某些URL?

2) Is it possible to have the ProxyErrorOverride directive only apply to some of the URLs in my ProxyPass statements?

推荐答案

arober11在上面的评论中指出:

As arober11 pointed out in the comment above:

害怕回答:否和否.如果该指令可以限制为 一个位置,目录或一组URL,那么将会有些 在手册页的上下文"部分中: httpd.apache.org/docs/2.2/mod/mod_proxy.html#proxyerroroverride

Afraid the answer is: No and No. If the directive could be limited to a location, directory, or set of URL's, then there would be something in the "Context" section, of the man page: httpd.apache.org/docs/2.2/mod/mod_proxy.html#proxyerroroverride

另一方面:您始终可以将其自己添加到mod_proxy.c中.

on the other hand: you can always add it to mod_proxy.c yourself.

这篇关于适用于特定URL模式的Apache mod-proxy ProxyErrorOverride的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆