![](/img/trans.png)
[英]React app working on localhost but giving error when deployed either on github or on heroku. No error while deploying
[英]React app giving 404 error when deployed to GCP
我已将我的反应应用程序部署到 GCP 的应用程序引擎。 它成功部署并且可以访问登录页面。 然而,这些路线都不起作用。 所有路线都给出“404”错误。 我很确定它的 app.yaml 配置有问题。 请帮忙!
runtime: nodejs10
handlers:
- url: /
static_files: build/index.html
upload: build/index.html
- url: /
static_dir: build
问题是您在/
url 中同时使用了static_files
和static_dir
。
您需要使用static_files
或static_dir
。
从您的问题的描述看来,您想使用static_dir
来匹配url: /
之后目录中的所有内容。
如文档中所述:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.