这是场景:
我正在通过<welcome-file-list>
从 GAE 服务为应用程序引擎支持的 angularjs 应用程序提供索引文档。
请求https://<project>.appspot.com/
通过以下方式提供static/index.html
<welcome-file-list>
<welcome-file>static/index.html</welcome-file>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
此索引.html文件包含最小化/丑化/组合静态资源的列表,名称中包含哈希值,用于缓存破坏目的。所有包含的资产都运行良好,但索引.html文件会根据 appengine 上的默认缓存规则缓存 600 秒。
我想为此文件设置无缓存标头,但它似乎不遵循在 appengine-web 中配置的过期值.xml通过<static-files>
.
我试过这个
<static-files>
<!- also without leading slash, same result -->
<include path="/static/index.html" expiration="30s" />
根据文档{1}和类似的SO问题{2},我建议你写这样的东西: (检查过期时间模式(
<static-files>
<!- also without leading slash, same result -->
<include path="/static/index.html" expiration="0d 0h 0m 30s" />
{1}:https://cloud.google.com/appengine/docs/standard/java/config/appref#static_cache_expiration
{2}:无法在 python 应用的 app.yaml 中设置缓存过期时间