将 create-react-app build 部署到 Google Cloud Platform 后找不到 URL
URLs not found after deploying create-react-app build to Google Cloud Platform
我已将 create-react-app 构建(带有 app.yaml 文件)上传到 GCP 存储桶。该应用随后已使用云 shell.
部署在 App Engine 实例上
转到应用程序的根目录 URL 工作正常。但是去example.com/anything
returns 出现如下错误:
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/
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.
我已将 create-react-app 构建(带有 app.yaml 文件)上传到 GCP 存储桶。该应用随后已使用云 shell.
部署在 App Engine 实例上转到应用程序的根目录 URL 工作正常。但是去example.com/anything
returns 出现如下错误:
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/
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.