Google app engine 在gae上返回404的Vue生产URL重定向
我有一个vue应用程序,我想部署到google app engine。我已经部署了它,一切正常,但当我手动输入url时,应用程序会以404响应。有没有办法设置app.yaml以允许从url重定向到SPAGoogle app engine 在gae上返回404的Vue生产URL重定向,google-app-engine,vuejs2,Google App Engine,Vuejs2,我有一个vue应用程序,我想部署到google app engine。我已经部署了它,一切正常,但当我手动输入url时,应用程序会以404响应。有没有办法设置app.yaml以允许从url重定向到SPA # GAE yml setup runtime: python27 api_version: 1 threadsafe: true # URL handlers handlers: - url: / static_files: dist/index.html upload:
# GAE yml setup
runtime: python27
api_version: 1
threadsafe: true
# URL handlers
handlers:
- url: /
static_files: dist/index.html
upload: dist/index.html
- url: /(.*)
static_files: dist/\1
upload: dist/(.*)
- url: .*
static_files: dist/index.html
upload: dist/index.html
# GAE has a limit of 10,000 files so ignore node_modules and anything else thats not neccassary
skip_files:
- node_modules/
- .gitignore
- src/
- public/
- babel.config.js
- ^(.*/)?\..*$
如何将处理程序重定向到SPA上的特定页面?关于您试图实现的目标
此特定解决方案(将所有URL重定向到单个URL)分两步工作,修改app.yaml
并在.py
文件中添加一些源代码
在app.yaml
中,添加:“应用程序引擎可以通过执行应用程序代码或通过提供与代码一起上载的静态文件(如图像、CSS或JavaScript)来处理URL。”
处理程序:
-网址:/*
脚本:main.py
在.py
文件中,添加“规则”以重定向
class AllHandler(webapp.RequestHandler):
def get(自我):
自我重定向(“http://example.com“,对)
application=webapp.WSGIApplication([('/.*',AllHandler)])