好吧,让我先打扫一下。我错误地在我的index.html
文件中添加了365d有效期。现在,我对JS文件进行了更改,从而更改了index.html
中的导入名称,现在它正尝试导入错误的文件。糟糕!
所以我想让我们将默认文件名更改为其他未缓存的文件。
我现在拥有的东西
在Angular项目中,我已经更改了所有建筑设置,因此现在我的index.html
文件名为main.html
。即使文件本身被命名为main.html
,并且在我的dist文件夹中检查,也没有index.html
只有main.html
。
我已经将网站托管在Google App Engine上,这是我在构建后用来部署的命令。
gcloud app deploy app.yaml --quiet --project=<project-name>
这是我的app.yaml
api_version: 1
env: standard
runtime: python27
service: <service-name>
threadsafe: yes
handlers:
- url: /(.*\.(css|eot|gz|html|ico|js|map|png|jpg|jpeg|svg|ttf|woff|woff2|pdf|gif))
static_files: dist/browser/\1
upload: dist/browser/(.*\.(css|eot|gz|html|ico|js|map|png|jpg|jpeg|svg|ttf|woff|woff2|pdf|gif))
expiration: "365d"
- url: /.*
static_files: dist/browser/main.html
upload: dist/browser/main.html
secure: always
expiration: "0s"
skip_files:
## bunch of files
问题:
看来Google仍在index.html
上服务,尽管说实话我不确定如何检查。如何告诉它将main.html
用作默认文件?
编辑1
当我访问www.my-domain.com
时,它仍然可以容纳旧的index.html
。但是,当我进入一个我从未去过的<project>.appspot.com
(谷歌URL)时,我猜测很长一段时间内,没有其他人(没有缓存)可以正常工作了。
似乎更改index.html
的名称对缓存提供程序来说并不重要,只是它们从/
获取数据。我问了另一个有关重定向到另一个URL /
=> app
(Redirect base `/` path to folder in Google App Engine)
编辑2
使用此处的技术(https://www.maxlaumeister.com/blog/how-to-use-google-app-engine-as-a-free-redirect-server/),我能够使重定向工作,因此,当用户加载/
时,服务器将重定向到/app/
。对于未缓存的appspot.com
网址,这很好用。我的自定义域仍然无法使用。
我很确定某些中间人(ISP或Tier 1提供程序)正在将整个GET请求缓存到/
。不只是index.html
还是服务器对/
我不确定我还有其他想法。还有其他方法可以破坏此缓存吗?