App Engine:部署时未更新静态文件 [英] App Engine: Static Files Not Updating on Deploy

查看:22
本文介绍了App Engine:部署时未更新静态文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用以下设置推送了一个包含 Angular SPA 的 HTML 静态文件作为我的自定义域的全能处理程序:

I pushed an HTML static file containing an Angular SPA as catch-all handler for my custom domain with this settings:

- url: /(api|activate|associate|c|close_fb|combine|import|password|sitemap)($|/.*)
  script: gae.php

- url: /.*
  static_files: public/static/app/v248/es/app.html
  upload: public/static/app/v248/es/app.html
  expiration: "1h"

效果很好,但是如果我推送一个新的 app.html,它就不会更新.我尝试更改本地路径,部署新的应用程序版本,甚至用自定义的 php 端点替换 catch-all 处理程序,但它不起作用,响应仍然是我上传的 app.html 的第一个版本.

That worked fine, but if I push a new app.html it doesn't update. I've tried to change the local path, deploy a new app version, even replacing the catch-all handler with a custom php endpoint, but it doesn't work, the response still is the first version of app.html I uploaded.

其他人也遇到了同样的问题(CSS 文件未更新Deploy (Google AppEngine)),看起来和 Google CDN 缓存有关,但据我所知,没有任何方法可以刷新它.

Other people has had the same problem (CSS File Not Updating on Deploy (Google AppEngine)), and it looks like is related to Google CDN cache but, as far as I know, there isn't any way to flush it.

推荐答案

在 App Engine 应用程序中对静态文件执行更改时,更改将不会立即可用,因为 缓存,正如您已经想象的那样.Google Cloud 中的缓存无法手动刷新,因此如果您想测试它是如何工作的,我建议您将过期时间更改为较短的时间段(默认为 10 分钟),然后根据需要设置适当的过期时间满足您的要求.

When performing changes in static files in an App Engine application, changes will not be available immediately, due to cache, as you already imagined. The cache in Google Cloud cannot be manually flushed, so instead I would recommend you to change the expiration time to a shorter period (by default it is 10 minutes) if you want to test how it works, and later setting an appropriate expiration time according to your requirements.

请记住,您可以更改静态缓存过期时间 适用于所有静态文件或仅适用于您选择,只需在 app.yaml 文件中设置适当的元素即可.

Bear in mind that you can change the static cache expiration time both for all static files or for just the ones you choose, just by setting the proper element in the app.yaml file.

这篇关于App Engine:部署时未更新静态文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆