我正在使用Spring boot 1.5.12 (JDK8)和嵌入式Undertow服务器1.4,我已经在我的属性中使用了'server.https.enabled: true‘来启用http2协议,但它似乎不起作用。我也有自己签署的证书安全连接。当我在浏览器上加载我的应用程序(Angular 5)时,我仍然得到http/1.1协议。
下面是我的SpringBootApplication类中的内容:
@SpringBootApplication
@EnableEurekaClient
@EnableOAuth2Sso
public class Application extends WebSecurityConfigurerAdapter {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
@Override
public void configure(HttpSecurity http) throws Exception {
//some authorization configuration
}
}Application.properties文件
security:
require-ssl: true
server:
ssl:
enabled: true
http2:
enabled: true
port: 8085
ssl:
key-store: classpath: keystore.p12
key-store-type: PKCS12
key-alias: devel
key-store-password: pass
key-password: pass
eureka:
client:
serviceUrl:
defaultZone: https://localhost:8761/eureka
instance:
preferIpAddress: false
securePortEnabled: true
securePort: ${server.port}还有什么我需要配置的吗?
提前感谢
发布于 2018-05-22 23:10:39
尝试将以下bean添加到配置中:
@Bean
UndertowEmbeddedServletContainerFactory embeddedServletContainerFactory() {
UndertowEmbeddedServletContainerFactory factory = new UndertowEmbeddedServletContainerFactory();
factory.addBuilderCustomizers(
builder -> builder.setServerOption(UndertowOptions.ENABLE_HTTP2, true));
return factory;
}发布于 2019-04-04 17:39:16
属性server.http2.enabled在spring boot 1.5.13中不存在。请参阅this
https://stackoverflow.com/questions/50470332
复制相似问题