繁体   English   中英

将create-react-app构建部署到Google Cloud Platform后找不到URL

[英]URLs not found after deploying create-react-app build to Google Cloud Platform

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

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

错误:找不到

在此服务器上找不到请求的URL /任何内容。

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: /.*
  static_files: build/index.html
  upload: build/index.html

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM