重命名Google App Engine上的index.html

好吧,让我先打扫一下。我错误地在我的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还是服务器对/

的响应

我不确定我还有其他想法。还有其他方法可以破坏此缓存吗?

bluegame111111 回答:重命名Google App Engine上的index.html

  

您可以通过修改app.yaml文件并添加处理程序来实现此目的,如下例所示:

在此处提供main.html

handlers:
- url: /
  static_files: app/main.html
  upload: app/main.html

投放index.html,而不是:

handlers:
    - url: /
      static_files: app/index.html
      upload: app/index.html

appindex.htmlmain.html所在的文件夹。您的外观可能有所不同。

,

angular-cli.json 中将value的{​​{1}} index.html 更改为 main.html

本文链接:https://www.f2er.com/3169167.html

大家都在问