![](/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.