广杰博客

  • 首页
  • IT资讯
  • IT运维
  1. 首页
  2. IT运维
  3. 正文

springboot nginx https 配置

08/12/2019 1569点热度 3人点赞 0条评论

在nginx上设置ssl证书,启用https,当tomcat里的应用发生转向请求时将转向为http而非https,为此我们需要告诉tomcat已被https代理,方法是增加X-Forwared-Proto和X-Forwarded-Port两个HTTP头信息。

nginx的location配置

location / {
proxy_pass http://127.0.0.1:8080;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}

springboot配置文件设置

server:
port: 8080
max-http-header-size: 10240
use-forward-headers: true
tomcat:
remote-ip-header: x-forwarded-for
protocol_header: x-forwarded-proto
port-header: X-Forwarded-Port

标签: springboot
最后更新:08/12/2019

guangjie

这个人很懒,什么都没留下

点赞
< 上一篇
下一篇 >
最新 热点 随机
最新 热点 随机
CentOS 8.3 (2011) ISO镜像下载发布 CentOS Linux 落幕 CentOS Stream 上位 CentOS Linux 7.9 (2009) iso镜像下载 Windows 10 2020年10月更新ISO下载 ubuntu ssh通过密钥登陆服务器 kubeadm修改证书时间 kubeadm安装k8s 组件controller-manager 和scheduler状态 Unhealthy CentOS 8.2 (2004) 镜像下载发布 Windows 10 v2004五月更新正式版MSDN原版ISO镜像下载 CentOS 7.8 (2003) 发布镜像下载
CentOS 7.8 (2003) 发布镜像下载Windows 10 v2004五月更新正式版MSDN原版ISO镜像下载CentOS 8.2 (2004) 镜像下载发布ubuntu ssh通过密钥登陆服务器kubeadm安装k8s 组件controller-manager 和scheduler状态 Unhealthykubeadm修改证书时间Windows 10 2020年10月更新ISO下载CentOS Linux 7.9 (2009) iso镜像下载CentOS Linux 落幕 CentOS Stream 上位CentOS 8.3 (2011) ISO镜像下载发布
微软免费数据同步软件SyncToy V2.1 创建自定义jdk版本和springboot应用程序docker镜像 解决Win7下无法下载ActiveX控件问题 CentOS 7.6 (1810) 正式发布 使用rewrite实现asp伪静态 windows10与centos7 双系统引导 win7系统打不开chm文件 centos6.2 以文本形式安装,不能自定义分区 使用电信通vps评测以及电信通vps价格 32位x86 windows 2003支持最大的内存介绍
友情链接
  • linux运维
  • 郑州SEO

COPYRIGHT © 2020 广杰博客. ALL RIGHTS RESERVED.

THEME KRATOS MADE BY VTROIS

豫ICP备07002435号-8