【问题标题】:Expiration in handlers in app.yaml for google app engine and laravel are not working谷歌应用引擎和 laravel 的 app.yaml 中的处理程序过期不起作用
【发布时间】:2019-05-20 11:24:52
【问题描述】:

我使用谷歌应用引擎来服务我的 laravel 应用程序,并想设置我位于 laravel 公用文件夹中的 javascript 和 css 文件的到期时间。

js和css文件的响应头:

cache-control: max-age=600, public

这是谷歌应用引擎的默认设置。

但在我的 app.yaml 中,我设置了以下内容:

runtime: php
env: flex

runtime_config:
document_root: public

skip_files:
- .env

# I tried to set this to see if the error is in my handlers, but it was 
# still the default 10mins
default_expiration: "30d"

handlers:
- url: /js/.*
  static_dir: public/js
  expiration: "30d"

- url: /css/.*
  static_dir: public/css
  expiration: "30d"

不知何故,我无法覆盖谷歌的默认设置,老实说,我不知道更多。

我已经在 php.ini 中禁用了 session.cache_limiter,就像这里建议的 Laravel response Cache-Control headers always containing 'no-cache'

还是没有区别。

【问题讨论】:

    标签: php laravel google-app-engine cache-control app.yaml


    【解决方案1】:

    您使用的是AppEngine柔性环境:env: flex不支持default_expirationexpiration,请尝试使用标准环境。

    【讨论】:

    • 哦,不,我不知道。谢谢!不过,标准环境对我来说不是一个选择。所以我猜我必须通过 nginx_conf_http_include 或 nginx_conf_include 传递一个 nginx 配置。
    猜你喜欢
    • 1970-01-01
    • 2023-03-11
    • 2016-07-14
    • 1970-01-01
    • 1970-01-01
    • 2018-02-05
    • 1970-01-01
    • 2012-09-10
    • 1970-01-01
    相关资源
    最近更新 更多