【问题标题】:Make nginx wait x seconds before returning the page让 nginx 在返回页面前等待 x 秒
【发布时间】:2019-12-29 23:07:13
【问题描述】:

我希望给定页面在 x 秒后加载,例如当有人访问 URL“https://example.com/examplelocation”时,浏览器将尝试加载页面几秒钟,然后 nginx 将返回其带有页面正文的 HTTP OK , 这可能吗? 伪代码:

location ~ ^/examplelocation/ {
  # wait some time and then send the response
}

【问题讨论】:

    标签: nginx nginx-location


    【解决方案1】:

    我知道echo module,它可以通过使用 echo_sleep 将响应延迟给定秒数。

    location / {
        echo_sleep 1;
        echo_exec @test;
    }
    location @test {
        echo $echo_request_uri;
    }
    

    如果有任何疑问,请告诉我。

    【讨论】:

      猜你喜欢
      • 2017-07-20
      • 2021-09-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-09-27
      • 2013-06-13
      • 1970-01-01
      相关资源
      最近更新 更多