【问题标题】:Apache proxy caching "service temporarily unavailable" response when target is down目标关闭时,Apache 代理缓存“服务暂时不可用”响应
【发布时间】:2020-07-28 22:33:34
【问题描述】:

我的节点服务器前面有 apache。节点在某个端口上运行,我正在使用 apache 代理到该端口,并且还为 https 配置了 apache。

当我启动 apache 然后启动我的节点服务器时,一切都运行良好。如果我关闭节点服务器并尝试访问我的服务 apache 会说“服务暂时不可用”。这是预期的,因为我的节点服务器已关闭。

但是,当我在不接触 apache 的情况下恢复服务器并尝试再次访问我的服务时,apache 仍然显示“服务暂时不可用”。它就像apache没有再试一次。如果我弹回 apache,一切都会好起来的。

由于我一直在运行,因此如果发生致命事件,我的服务器可能会关闭几秒钟。如果发生这种情况,我不想退回 apache。

有没有办法让 apache 始终尝试而不缓存它最近尝试访问的服务不可用的事实?

【问题讨论】:

    标签: apache mod-proxy


    【解决方案1】:

    您需要在 ProxyPass 指令中添加 retry=0。 所以它会是这样的:

    ProxyPass /example http://backend.example.com retry=0
    

    在这里查看一些信息:http://httpd.apache.org/docs/current/mod/mod_proxy.html#proxypass

    【讨论】:

      猜你喜欢
      • 2016-01-27
      • 2013-09-29
      • 2021-07-25
      • 1970-01-01
      • 1970-01-01
      • 2011-12-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多