springboot2 配置 https
package cn.xiaojf.aibus.configure; import org.apache.catalina.Context;
import org.apache.catalina.connector.Connector;
import org.apache.coyote.http11.Http11NioProtocol;
import org.apache.tomcat.util.descriptor.web.SecurityCollection;
import org.apache.tomcat.util.descriptor.web.SecurityConstraint;
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
import org.springframework.boot.web.servlet.server.ServletWebServerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile; /**
* http ssl 配置
* @author xiaojf 2019/9/21 20:07
*/
@Configuration
@Profile("prod")
public class HttpsConfigure { @Bean
public ServletWebServerFactory servletWebServerFactory() {
TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory() {
@Override
protected void postProcessContext(Context context) {
SecurityConstraint securityConstraint = new SecurityConstraint();
securityConstraint.setUserConstraint("CONFIDENTIAL");
SecurityCollection securityCollection = new SecurityCollection();
securityCollection.addPattern("/*");
securityConstraint.addCollection(securityCollection);
context.addConstraint(securityConstraint);
}
};
factory.addAdditionalTomcatConnectors(redirectConnector());
return factory;
} private Connector redirectConnector() {
Connector connector = new Connector(Http11NioProtocol.class.getName());
connector.setScheme("http");
connector.setPort(8100);
connector.setSecure(false);
connector.setRedirectPort(443);
return connector;
}
}
修改配置文件
server:
ssl:
key-store: classpath:ssl/2833975_www.renyimao.cn.pfx
key-store-password: KzwpacCY
keyStoreType: PKCS12
port: 443 #启动端口
文件目录

springboot2 配置 https的更多相关文章
- 腾讯云域名申请+ssl证书申请+springboot配置https
阿里云域名申请 域名申请比较简单,使用微信注册阿里云账号并登陆,点击产品,选择域名注册 输入你想注册的域名 进入域名购买页面,搜索可用的后缀及价格,越热门的后缀(.com,.cn)越贵一般,并且很可能 ...
- SpringBoot配置Https
HTTPS (全称:Hyper Text Transfer Protocol over SecureSocket Layer),是以安全为目标的 HTTP 通道,在HTTP的基础上通过传输加密和身份认 ...
- Nginx配置Https
1.申请证书: https://console.qcloud.com/ssl?utm_source=yingyongbao&utm_medium=ssl&utm_campaign=qc ...
- 天河微信小程序入门:阿里云tomcat免费配置https
天河君在第一时间通过了微信小程序验证,开启了我的微信小程序之旅.因为天河君之前是一名后端狗,对前端不是很了解,所以几乎可以认为是从零开始学做微信小程序.也希望有志在微信小程序方向做点事情的朋友能够和我 ...
- 在 IIS 6 和 IIS 7中配置Https,设置WCF同时支持HTTP和HTPPS,以及使用HttpWebRequest和HttpClient调用HttpS
IIS 7 ,给IIS添加CA证书以支持https IIS 6 架设证书服务器 及 让IIS启用HTTPS服务 WCF IIS 7中配置HTTPS C#利用HttpWebRequest进行post请求 ...
- nginx 反向代理 配置 https 实现http https同时存在
server { listen ssl; #监听443端口 server_name www.app01.com; ssl on; #启用ssl加密 ssl_certificate /etc/cert/ ...
- 【burp】配置HTTPS抓包方法
以Chrome为例,配置HTTPS抓包方法 1.获取破解版的burp,将BurpLoader.jar和burpsuite_pro_v1.5.18.jar放到一个路径下 2.在cmd里进入上述两个jar ...
- YTKNetworkConfig配置HTTPS请求
YTKNetworkConfig配置HTTPS请求 p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Menlo; color: #ad91cc ...
- Apache配置HTTPS功能
apache配置https 一.yum 安装openssl和openssl-devel,httpd-devel 二.生成证书(也可以从公司的证书颁发机构获取): #建立服务器密钥 openssl ge ...
随机推荐
- lis框架showoncodename的用法
fm.Sex.value=tContent2[0][3];//这个一定得是查询出来的码值alert("获取到的值是:"+tContent2[0][3]);showOneCodeNa ...
- js 符号转换 html代码
S转换HTML转义符 //去掉html标签 function removeHtmlTab(tab) { return tab.replace(/<[^<>]+?>/g,''); ...
- 【洛谷P5158】 【模板】多项式快速插值
卡常严重,可有采用如下优化方案: 1.预处理单位根 2.少取几次模 3.复制数组时用 memcpy 4.进行多项式乘法项数少的时候直接暴力乘 5.进行多项式多点求值时如果项数小于500的话直接秦九昭展 ...
- WinDbg常用命令系列---显示段选择器dg、链接列表dl和字符串ds/dS
dg (Display Selector) dg命令显示指定选择器的段描述符. dg FirstSelector [LastSelector] 参数: FirstSelector指定要显示的第一个选择 ...
- Omnibus-ctl: What is it and what can it do for you?
转自:https://blog.chef.io/2015/05/26/omnibus-ctl-what-is-it-and-what-can-it-do-for-you/ Are you buildi ...
- 利用Python进行数据分析【第二版】【高清中文版英文版源代码】
如果被河蟹请回复我更新链接 这是我花钱弄的,免费分享给大家.没有密码,直接可以观看! 希望大家不要拿去后再做收费分享 如果好用,请给个赞好嘛~~~ 1.中文pdf 链接:https:/ ...
- 微信小程序 报错:Setting data field "xxx" to undefined is invalid
通过网络请求获取的数据,当返回的数据没有xxx(变量名)这个变量时,此时xxx是undefined 若使用setData进行赋值,则会报如下的错误: Setting data field " ...
- Centos分区/超过2T的磁盘
centos分区大于2TB 用parted分区工具分区 fdisk -l 查看要分的区(我这里是/dev/vdb) parted /dev/vdb #进入/dev/vdb进行分区 mktabl ...
- process.env.NODE_ENV理解
1.理解NODE_ENV 在node中,有全局变量process表示的是当前的node进程.process.env包含着关于系统环境的信息.但是process.env中并不存在NODE_ENV这个东西 ...
- 从宿主机直接进入docker容器的网络空间
Docker dns nameserver 也是进入容器网络空间,监听53端口,但它通过iptable把端口映射到宿主机上,处理DNS请求的进程就在宿主机上. how does Docker Embe ...