[英]Apache: how to use substitute on error pages?
I have set up a reverse proxy and I'm using mod_filter for text substitutions ie: 我已经设置了一个反向代理,我正在使用mod_filter进行文本替换,即:
FilterDeclare MYFILTER FilterProvider MYFILTER SUBSTITUTE "%{CONTENT_TYPE} =~ m|^text/html|" FilterDeclare MYFILTER FilterProvider MYFILTER SUBSTITUTE“%{CONTENT_TYPE} = ~m | ^ text / html |”
FilterChain MYFILTER Substitute "s|some text|test|i" FilterChain MYFILTER替换“s | some text | test | i”
This works fine on pages with status code 200 but doesn't seem to run on error pages (404, 503, etc). 这在状态码为200但在错误页面(404,503等)上似乎不运行的页面上工作正常。
Any ideas what I might be missing? 任何想法我可能会失踪?
The docs say filter normally applies to response status 200. To enable it to all statuses we set environment variable filter-errordocs. 文档说过滤器通常适用于响应状态200.为了使其能够使用所有状态,我们设置了环境变量filter-errordocs。 See also mod_filter: Why does a SUBSTITUTE not work for certain URLs?
另请参见mod_filter:为什么SUBSTITUTE不适用于某些URL?
# filter-errordocs: http://httpd.apache.org/docs/2.4/mod/mod_filter.html
# https://stackoverflow.com/questions/18163195/mod-filter-why-does-a-substitute-not-work-for-certain-urls
SetEnv filter-errordocs
FilterDeclare MYFILTER FilterProvider MYFILTER SUBSTITUTE "%{CONTENT_TYPE} =~ m|^text/html|"
FilterChain MYFILTER Substitute "s|some text|test|i"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.