Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs Appengine HTTPS安全:始终使用CloudFlare导致重定向循环_Angularjs_Google App Engine_Redirect_Https_Cloudflare - Fatal编程技术网

Angularjs Appengine HTTPS安全:始终使用CloudFlare导致重定向循环

Angularjs Appengine HTTPS安全:始终使用CloudFlare导致重定向循环,angularjs,google-app-engine,redirect,https,cloudflare,Angularjs,Google App Engine,Redirect,Https,Cloudflare,当将secure设置为always on app.yaml时,在尝试加载网站的http或https版本时,我得到的只是无穷无尽的302重定向 application: xxx version: 1 runtime: python27 api_version: 1 threadsafe: true default_expiration: "200d" handlers: - url: /favicon.ico static_files: favicon.ico upload: fav

当将secure设置为always on app.yaml时,在尝试加载网站的http或https版本时,我得到的只是无穷无尽的302重定向

application: xxx
version: 1
runtime: python27
api_version: 1
threadsafe: true

default_expiration: "200d"

handlers:

- url: /favicon.ico
  static_files: favicon.ico
  upload: favicon.ico

- url: /robots.txt
  static_files: robots.txt
  upload: robots.txt

- url: /fonts
  static_dir: fonts

- url: /styles
  static_dir: styles

- url: /scripts
  static_dir: scripts

- url: /images/(.*\.(gif|png|jpg|svg))$
  static_files: images/\1
  upload: images/.*\.(gif|png|jpg|svg)$

- url: /.*
  static_files: index.html
  upload: index.html
  secure: always
这是一个有角度的应用程序,这就是我处理index.html上所有URL的原因


Cloudflare位于我的appengine应用程序前面,具有以下SSL选项:


这是怎么回事?我是否需要将SSL证书添加到AppEngine并将SSL模式切换为full以使其正常工作?我不明白为什么它在通过CloudFlare时会重定向到http,然后再返回https。

我无法重现
curl-L--dump header/tmp/head的问题http://myappid.appspot.com/
——这将生成一个/tmp/head,其中正好包含两个预测的节(302的位置为https…等,然后是200 OK)而且是正确的结果。当然,我不能确切地告诉您的浏览器和/或您的angular/JS代码在重定向后发生了什么。你能试试这个卷曲并编辑你的问题来发布/tmp/head吗?这将有助于我们更详细地了解问题,如果它是在应用程序引擎中的话——或者表明GAE很好,并且您的JS代码中有一个bug。@AlexMartelli没有提供任何线索。我正在开始一个新项目,并将尝试复制。角度代码根本就达不到,我相信它似乎是相关的。@AlexMartelli哦。。。还有云闪。我忘记了cloudflare。在app.yaml上将secure临时设置为optional,并在cloudflare上创建页面规则,以便在裸域和任何子域上将流量转发到https。我无法重现curl-L--dump header/tmp/head的问题http://myappid.appspot.com/——这将导致a/tmp/head正好包含两个预测节(302找到位置:https…等,然后是200 OK)和正确的结果。当然,我不能确切地告诉您的浏览器和/或您的angular/JS代码在重定向后发生了什么。你能试试这个卷曲并编辑你的问题来发布/tmp/head吗?这将有助于我们更详细地了解问题,如果它是在应用程序引擎中的话——或者表明GAE很好,并且您的JS代码中有一个bug。@AlexMartelli没有提供任何线索。我正在开始一个新项目,并将尝试复制。角度代码根本就达不到,我相信它似乎是相关的。@AlexMartelli哦。。。还有云闪。我忘记了cloudflare。在app.yaml上将secure临时设置为可选,并在cloudflare上创建页面规则,以便在裸域和任何子域上将流量转发到https。
curl -L --dump-header /tmp/head example.org

HTTP/1.1 302 Found
Server: cloudflare-nginx
Date: Wed, 23 Dec 2015 13:57:32 GMT
Content-Type: text/html
Transfer-Encoding: chunked
Connection: keep-alive
Set-Cookie: __cfduid=d82f41e169b9140f8a0e3cb1b2ac5b1de1450879051; expires=Thu, 22-Dec-16 13:57:31 GMT; path=/; domain=.example.org; HttpOnly
Location: https://example.org/
CF-RAY: 2594937966dd18c1-GRU

... 48 more of these ...

HTTP/1.1 302 Found
Server: cloudflare-nginx
Date: Wed, 23 Dec 2015 13:57:32 GMT
Content-Type: text/html
Transfer-Encoding: chunked
Connection: keep-alive
Set-Cookie: __cfduid=d82f41e169b9140f8a0e3cb1b2ac5b1de1450879051; expires=Thu, 22-Dec-16 13:57:31 GMT; path=/; domain=.example.org; HttpOnly
Location: https://example.org/
CF-RAY: 2594937966dd18c1-GRU
curl -L --dump-header /tmp/head myppid.appspot.com

HTTP/1.1 302 Found
Location: https://myppid.appspot.com/
Date: Tue, 22 Dec 2015 18:20:23 GMT
Content-Type: text/html
Server: Google Frontend
Content-Length: 0

HTTP/1.1 200 OK
Date: Tue, 22 Dec 2015 18:20:23 GMT
Expires: Sat, 09 Jul 2016 18:20:23 GMT
Cache-Control: public, max-age=17280000
ETag: "0tVHeg"
Content-Type: text/html
Server: Google Frontend
Content-Length: 11144
Alternate-Protocol: 443:quic,p=1
Alt-Svc: quic=":443"; ma=604800; v="30,29,28,27,26,25"