TL;DR
Google平台路由分配对于HTTP和HTTPS的行为不同,我无法找出原因(或者找到一个参考)。
设置
default服务,它具有(绝对标准的) app.yaml:
运行时: python : flex : gunicorn -b :$PORT .wsgi beta_settings: cloud_sql_instances: runtime_config: python_version: 3
这是一个Django应用程序,为API和Admin接口提供服务。frontend服务,它(同样是绝对标准的) app.yaml:
服务:前端运行时: python27 api_version: 1 threadsafe:真正的处理程序:- url: /静态/(.*) static_files:构建/静态/\1上传:构建/静态/(.*)- url: /.* static_files: build/index.html上传: build/index.html
它是一个ReactJS应用程序,它使用API并充当前端。dispatch.yaml:
分派:- url:"*/api/*“服务: default - url:"*/admin/*”服务: default - url:"*/*“服务:前端
意思是“服务/api/...和/admin/...来自default服务,其余来自frontend服务”。好的。问题
当我转到http://<project-id>.appspot.com (注意HTTP)时,一切都如预期的那样工作。即:
但是,当我对https://<project-id>.appspot.com做同样的操作(注意HTTP)时,所有的东西都会被重定向到前端。即:
更荒谬的是,前端的子域,即https://frontend-dot-<project-id>.appspot.com,按预期返回所有内容,包括HTTP和HTTPS中的API和Admin。
问题
我错过了什么咒语来使它像预期的那样与HTTPS一起工作?我真的不想通过HTTP提供管理界面.
发布于 2018-01-10 15:29:27
好的,知道了(这在GCP中是没有问题的)。
如果其他人在未来遇到类似的问题,下面是我所发生的事情:
frontend-dot-<project-id>.appspot.com子域使用相同的后端没有传递cookie,因为它的域是<project-id>.appspot.com。所以,毕竟,它就像清除我的浏览数据一样简单。哈。
https://stackoverflow.com/questions/48189749
复制相似问题