0

如果发生某些情况,我正在寻找覆盖 ErrorDocument 503的方法。

场景:
当我在系统中手动创建文件标志时(出于维护目的)

触摸 /var/state/technical

这会切断对“后端”的调用,抛出HTTP 503 - 这是完美的。
虚拟主机 apache 代码:

    ErrorDocument 503 /some_error_page.html

    RewriteCond /var/state/technical -f
    RewriteRule ^/some_page.* http://127.0.0.1:1/ [P]

这就像魅力一样,但我无法区分
503 - “后端”故障

503 - “技术”维护


我现在的研究:
您可以更改 LocationMatch 上的 ErrorDocument:

<LocationMatch ^/some_url(.*)>
    ErrorDocument 503 /technical_page.html
</LocationMatch>

“理想词”的工作方式如下:(这是糟糕的 apache 语法)

RewriteCond /var/state/technical -f
ErrorDocument 503 /technical_page.html

目前:

RewriteCond /var/state/technical -f
RewriteRule .* http://127.0.0.1:80/technical_page.html [PT]

有效,但返回
HTTP 200响应代码。
如果我可以在这里覆盖响应代码,那就足够了。

我不能使用简单的重定向 R=503

RewriteRule !^/error|ping/.* /technical.html [PT,R=503]

因为它会显示默认的 503 错误页面(ErrorDocument 503 /some_error_page.html

有什么建议么?apache2.2

4

0 回答 0