假设 http://example.com:8080/example/swagger-ui.html 是我之前使用的 swagger url。然后我实现了 SSL,将应用程序的端口号更改为 8443。 现在我应该可以用 https://example.com:8443/example/swagger-ui.html 打开 swagger 但它重定向到端口 8080 并给我错误页面,内容为:
此站点无法提供安全连接 example.com 发送了无效响应。 ERR_SSL_PROTOCOL_ERROR
我在 springboot 应用程序中的 SwaggerConfig 文件中尝试了一些更改,如下所述:
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.protocols(Collections.singleton("https"))
.host("example.com:8443")
.select().apis(RequestHandlerSelectors.any()).paths(PathSelectors.any())
.build().directModelSubstitute(Calendar.class, String.class);
}
但直到现在都没有运气。请帮忙。 谢谢