广杰博客

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

springboot nginx https 配置

08/12/2019 2519点热度 7人点赞 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

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

点赞
< 上一篇
下一篇 >
最新 热点 随机
最新 热点 随机
Red Hat Enterprise Linux 9 发布,大量组件升级 windows10 家庭版添加hyper-v虚拟机组件 Red Hat Enterprise Linux 8.5 GA 发布 Rocky Linux 8.4 GA正式版发布下载 Rocky Linux 8.3 首个候选版本发布 CentOS 8.3 (2011) ISO镜像下载发布 CentOS Linux 落幕 CentOS Stream 上位 CentOS Linux 7.9 (2009) iso镜像下载 Windows 10 2020年10月更新ISO下载 ubuntu ssh通过密钥登陆服务器
PHP4.4在IIS下配置 幻灯片轮换代码 常见的PHP安全设置细节 windows10与centos7 双系统引导 elasticsearch 滚动重启 nginx php上传大文件的设置方法 Linux服务器安全策略详解 windows server 2008下任务计划不能正常执行bat批处理文件 win7连接到网络时提示“windows通讯端口初始化失败" 创建自定义jdk版本和springboot应用程序docker镜像
标签聚合
redhat Windows Server 2012 Hyper-V php_curl springboot linux nginx android
友情链接
  • linux运维
  • 郑州SEO

COPYRIGHT © 2021 gjie.cn. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang

豫ICP备07002435号-8