SpringBoot Https的证书配置和使用以及容器服务https的部署
1.证书放在位置
2.application.yml 配置文件
3.在SpringBoot 启动文件里添加
/**
* it’s for set http url auto change to https
/
@Bean
public EmbeddedServletContainerFactory servletContainer() {
TomcatEmbeddedServletContainerFactory tomcat = new TomcatEmbeddedServletContainerFactory() {
@Override
protected void postProcessContext(Context context) {
SecurityConstraint securityConstraint = new SecurityConstraint();
securityConstraint.setUserConstraint(“CONFIDENTIAL”);// confidential
SecurityCollection collection = new SecurityCollection();
collection.addPattern("/");
securityConstraint.addCollection(collection);
context.addConstraint(securityConstraint);
}
};
tomcat.addAdditionalTomcatConnectors(httpConnector());
return tomcat;
}
@Bean public Connector httpConnector() { Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol"); connector.setScheme("http"); connector.setPort(18007); connector.setSecure(false); connector.setRedirectPort(443); return connector; }
二、域名服务器配置
(https默认端口是 443,故需吧程序的端口改为443),http的端口修改成18007,然后自动转发到 https的443端口
- 点赞
- 收藏
- 分享
- 文章举报
- Nginx https的安装配置以及证书的使用
- linux服务(二)主流论坛软件使用和虚拟主机及https,认证配置
- 6426C Lab2 部署和配置证书服务
- 阿里云证书服务如何配置部署
- Windows XP下部署php apche mysql时 不能使用mysql_connect的问题:以及安装配置步骤
- 【服务器搭建环境配置】Linux上部署Nginx服务以及故障排除
- windows Server以及linux下证书服务的配置
- 使用Apache模块编译安装搭建LAMP平台以及部署DedeCMS网站配置详解
- 使用ASP.NET Web Api构建基于REST风格的服务实战系列教程【四】——实现模型工厂,依赖注入以及格式配置
- 在windows上部署redis服务,以及使用jedis客户端。
- nginx配置https之使用第三方证书
- idea集成开发工具的使用,tomcat服务器配置以及项目部署
- 还不知道阿里云证书服务如何配置部署,你out了
- HTTPS之Tomcat域名服务证书服务配置
- 使用Helm 在容器服务k8s集群一键部署wordpress
- 关于IDEA的基本环境配置以及快速使用(git拉载程序,Jdk安装,tomcat部署,应用程序打包运行)
- fishcorecpe和openacs使用https进行交互的技术设置和服务部署
- CloudStack 的配置、部署与管理,以及 API 的使用
- 使用沃通免费证书在tomca下t配置https实战
- 使用自签的证书配置nginx的https