标签:his boot redirect 关闭 参考 maven 文件中 项目 mbed
keytool -genkey -alias tomcat -storetype PKCS12 -keyalg RSA -keysize 2048 -keystore keystore.p12 -validity 3650
参数含义:
1.-storetype 指定密钥仓库类型
2.-keyalg 生证书的算法名称,RSA是一种非对称加密算法
3.-keysize 证书大小
4.-keystore 生成的证书文件的存储路径
5.-validity 证书的有效期
在配置类中添加如下method
@Bean public EmbeddedServletContainerFactory tomcatEmbeddedServletContainerFactory() { final TomcatEmbeddedServletContainerFactory factory = new TomcatEmbeddedServletContainerFactory(); factory.addAdditionalTomcatConnectors(this.createConnection()); return factory; } private Connector createConnection() { final String protocol = "org.apache.coyote.http11.Http11NioProtocol"; final Connector connector = new Connector(protocol); connector.setScheme("http"); connector.setPort(8080);// http端口 connector.setRedirectPort(443);// https端口 return connector; }
重定向成功,哈哈
DerInputStream.getLength(): lengthTag=111, too big.
该错误产生是因为maven的resouce过滤破坏了.p12文件,通过在pom文件中添加配置即可
<resources> <resource> <directory>src/main/resources</directory> <filtering>true</filtering> <excludes> <exclude>**/*.p12</exclude> </excludes> </resource> <resource> <directory>src/main/resources</directory> <filtering>false</filtering> <includes> <include>**/*.p12</include> </includes> </resource> </resources>
标签:his boot redirect 关闭 参考 maven 文件中 项目 mbed
原文地址:https://www.cnblogs.com/zad27/p/10521392.html