[英]React app giving 404 error when deployed to GCP
I have deployed my react app to GCP's App engine.我已将我的反应应用程序部署到 GCP 的应用程序引擎。 It successfully deploys and the landing page is accessible.
它成功部署并且可以访问登录页面。 However none of the routes work.
然而,这些路线都不起作用。 All the routes are giving '404' error.
所有路线都给出“404”错误。 I am pretty sure its the app.yaml configuration that has issue.
我很确定它的 app.yaml 配置有问题。 Help please!
请帮忙!
runtime: nodejs10
handlers:
- url: /
static_files: build/index.html
upload: build/index.html
- url: /
static_dir: build
The issue is that you are using both static_files
and static_dir
to your /
url.问题是您在
/
url 中同时使用了static_files
和static_dir
。
You need to either use static_files
or static_dir
.您需要使用
static_files
或static_dir
。
From the description of your question it looks like you want to use static_dir
to match everything that is inside the directory after the url: /
.从您的问题的描述看来,您想使用
static_dir
来匹配url: /
之后目录中的所有内容。
As stated in the documentation:如文档中所述:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.