受欢迎的博客标签

Cloudflare series:ERR_TOO_MANY_REDIRECTS

Published

 

 

 

网站结构

client user <->  cf   <-> nginx (port:80 and port 443) <->  local server port 80

Browser ->Cloudflare->Origin Server

Off (not secure) .  

Flexible
Encrypts traffic between the browser and Cloudflare. Browser https->Cloudflare转发到 nginx server 80 port

Full
Encrypts end-to-end, using a self signed certificate on the server.

Browser https->Cloudflare转发到 nginx server 443 port

 Full (strict)
Encrypts end-to-end, but requires a trusted CA or Cloudflare Origin CA certificate on the server

 

一、问题描述

chrome浏览器 地址栏返回,F12 控制台报错

net::ERR_TOO_MANY_REDIRECTS

浏览器连续发出大量的301重定向申请

二、网站结构

1.本地服务器为nginx,反向代理后台网站

2.本地服务器nginx使用的https。

三、原因分析

1.浏览器客户端使用https访问时,代理到nginx本地服务器http:*:80端口

2.nginx 检测到http协议80端口,重定向到https://*:443端口

3.cf重新发起https 访问,到达nginx后,又是访问的80端口,又被重定向到https,重新回到了1

 

 

三、解决办法

cf设置为end to end full模式。local server 为自定义模式。

Full
Encrypts end-to-end, using a self signed certificate on the server