gpt4 book ai didi

reactjs - 将 create-react-app build 部署到 Google Cloud Platform 后找不到 URL

转载 作者:行者123 更新时间:2023-12-02 15:03:46 24 4
gpt4 key购买 nike

我已将 create-react-app 构建(带有 app.yaml 文件)上传到 GCP 存储桶。然后,该应用已使用云外壳部署在 App Engine 实例上。

转到应用程序的根 URL 工作正常。但是转到 example.com/anything 会返回以下错误:

Error: Not Found

The requested URL /anything was not found on this server.

App.yaml 文件如下所示:

runtime: python27
api_version: 1
threadsafe: true
handlers:
- url: /(.*\.(html|css|js))
static_files: build/\1
upload: build/(.*\.(html|css|js))

- url: /
static_files: build/index.html
upload: build/index.html

最佳答案

您没有/anything 的处理程序。如果你想要一个包罗万象的 url,请使用正则表达式类型处理程序:

- url: /.*
static_files: build/index.html
upload: build/index.html

或者,如果您想为它们提供 anything.html 作为静态文件,请将其放入您的 build 目录,然后导航至 /anything.html 。您的第一个处理程序已设置为映射该 url。

关于reactjs - 将 create-react-app build 部署到 Google Cloud Platform 后找不到 URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48015085/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com