CSS 文件未在部署时更新 (Google AppEngine) [英] CSS File Not Updating on Deploy (Google AppEngine)

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

问题描述

我推送了我网站的新版本,但现在 CSS 和静态图像没有正确部署.

I pushed a new version of my website, but now the CSS and static images are not deploying properly.

这是混乱的页面:http://www.gaiagps.com

Appengine 显示最新版本是正确的:http://1.latest.gaiagps.appspot.com/

Appengine shows the latest version as being correct though: http://1.latest.gaiagps.appspot.com/

有什么帮助吗?

推荐答案

我以前在 App Engine 上看到过这种情况,即使使用像 /stylesheets/default.css?{{ App.版本}}.

I've seen this before on App Engine, even when using cache-busting query parameters like /stylesheets/default.css?{{ App.Version }}.

这是我的(未经证实的)理论:

Here's my (unconfirmed) theory:

  1. 您可以通过将新版本部署或更改为 default 来推送新版本.
  2. 虽然此更新正在传播到所有运行您的应用程序的 GAE 实例...
  3. ...有人访问了您的网站.
  4. 对静态资源 default.css{{ App.Version }} 的请求被发送到 Google 的 CDN,但目前还没有.
  5. Google 的 CDN 在所有实例的第 2 步传播之前向 GAE 请求资源.
  6. 如果您不走运,GAE 会从运行旧版本的实例中提供资源...
  7. ...现在作为权威的新"版本缓存在 Google 的 CDN 中.
  1. You push a new version by deploying or changing a new version to default.
  2. While this update is being propagated to all GAE instances running your app...
  3. ...someone hits your site.
  4. The request for static resource default.css{{ App.Version }} is sent to Google's CDN, which doesn't yet have it.
  5. Google's CDN asks GAE for the resource before propagation from step #2 is done for all instances.
  6. If you're unlucky, GAE serves up the resource from an instance running the old version...
  7. ...which now gets cached in Google's CDN as the authoritative "new" version.

当这种情况(如果发生这种情况)发生时,我可以确认,再多的缓存破坏浏览器工作也无济于事.Google CDN 服务器保存的版本错误.

When this (if this is what happens) happens, I can confirm that no amount of cache-busting browser work will help. The Google CDN servers are holding the wrong version.

修复:我发现修复此问题的唯一方法是部署另一个版本.您不会冒再次发生这种情况的风险(如果您在竞争条件发生后没有进行任何 CSS 更改),因为即使发生竞争条件,您的第一次更新也可能在您部署第二个更新时完成,所以无论如何,所有实例都将提供正确的版本.

To fix: The only way I've found to fix this is to deploy another version. You don't run the risk of this happening again (if you haven't made any CSS changes since the race condition), because even if the race condition occurs, presumably your first update is done by the time you deploy your second one, so all instances will be serving the correct version no matter what.

这篇关于CSS 文件未在部署时更新 (Google AppEngine)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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