Nginx 中强制 HTTPS 访问常用配置

1
2
3
4
5
server {
listen 80;
server_name example.com;
return 301 https://$host$request_uri;
}

Kong Route 的相关设置方法

  1. Protocols 仅支持 https,不再支持 http
  2. Https redirect status code 设置为 301

Https redirect status code

The status code Kong responds with when all properties of a Route match except the protocol, i.e. if the protocol of the request is HTTP instead of HTTPS. Location header is injected by Kong if the field is set to 301, 302, 307 or 308. Defaults to 426.

相关参考