【问题标题】:Google App Engine : default_expiration not overriden by Cache-Control:no-cacheGoogle App Engine : default_expiration 未被 Cache-Control:no-cache 覆盖
【发布时间】:2020-06-04 12:53:55
【问题描述】:

您好,我想在所有文件上放置“一年”的缓存,除了 ìndex.html 我想要 Cache-Control: no-cache 但我得到: 我希望最后一行覆盖 default_expiration 但我得到:

cache-control: no-cache
cache-control: public, max-age=31536000

我的app.yaml

runtime: nodejs12
default_expiration: '365d'
env_variables:
  environment: '--prod'
handlers:
    - url: /
    static_files: myproject/index.html
    upload: myproject/index.html
    http_headers:
      Cache-Control: no-cache

在 index.html....两者同时你知道如何只有第一个标题吗?

【问题讨论】:

    标签: google-app-engine cache-control no-cache


    【解决方案1】:

    这实际上是目前的预期行为。

    1) 如果您在处理程序的 http_headers 中设置了 default_expiration: 0 和 Cache-Control: no-cache ,则将设置以下标头:

    缓存控制:无缓存,必须重新验证 过期时间:格林威治标准时间 1990 年 1 月 1 日星期五 00:00:00

    2) 如果 default_expiration 是默认值 (10m),或者在您的案例中设置了特定值“365d”,并且您在每个处理程序的基础上覆盖到期,则到期处理程序:0 也将提供 10m或值集缓存。所以,你得到的输出实际上是此刻的预期输出。

    我同意 2) 可能出乎意料,App Engine 团队已在 this threadthis issue link 上提出了同样的担忧。目前不认为这是一个错误,但内部功能请求已提交给 App Engine 团队进行必要的修改。我建议您将问题链接添加为书签以获取有关修复的更新,因为目前没有实施的 ETA。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-08-10
      • 2011-09-08
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多