英文:
appengine randomly serves old files
问题
我目前正在使用Google Appengine来托管一个以Golang
作为后端的网站。我已经设置了自定义域名,有时它能正常工作。我的网站需要从服务器获取一些CSS和JS文件。过去这些文件都能正常提供,但现在它们会随机停止工作。无论是在"mydomain.de"还是"myapp.appspot.com"域名上都会出现这个问题。有时它在正常域名上工作,然后在另一个域名上工作,有时甚至两个域名都能正常工作。但如果我在几分钟后重新加载网站,它只会显示一个旧的index.html文件(我几天前已经删除了该文件)。
有人在过去遇到过这个问题吗?有人知道如何解决吗?
提前感谢。
英文:
I'm currently using Google Appengine to host a website with Golang
as the backend. I have a custom domain setup and (sometimes) it works perfectly fine. My website requires some css and js files from the server. These were served perfectly in the past but now it randomly stops working. Both on the "mydomain.de" and on the "myapp.appspot.com" domains. Sometimes it works on the normal domain and then it works on the other and sometimes even on both. But if I reload the site after a couple of minutes it just shows me an old index.html file (that I have removed days ago).
Did someone experience this problem in the past and does anyone know a fix for this?
Thanks in advance.
答案1
得分: 2
你是否排除了浏览器缓存作为问题的来源?如果在获取到旧版本后,使用Shift+刷新(假设使用Chrome或Firefox)可以显示所需的版本,那么请查看如何对CSS和JS进行“缓存破坏”,并检查app.yaml
文档以了解如何设置静态资源的过期时间(假设你的index.html
是静态的)。
英文:
Have you ruled out your browser cache as the source of the problem? If after getting a stale version, shift-reload (assuming Chrome or Firefox) brings up the desired version, then look into how to do "cache busting" for css and js, and check the app.yaml
doc for how to set expiration times on static assets (assuming your index.html
is static).
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论