Configure SSL on Camel rest-component using Spring-Boot with embedded Jetty

主宰稳场 提交于 2021-02-19 05:48:18

问题


Been bashing my head in for a few days trying to get SSL working with an existing rest endpoint. Currently using self-signed certificates in a jks.

We have a rest route (not this route, but very similar):

@Override
public void configure() {

    restConfiguration()
            .component("jetty")
            .scheme("https")
            .bindingMode(RestBindingMode.off)
            .dataFormatProperty("prettyPrint", "true")
            .port(8443);

    rest("/post")
            .post()
            .consumes("application/json")
            .produces("application/json")
            .to( // next endpoint // ); 

This works perfectly over HTTP. When we set the scheme as HTTPS, Jetty throws a SSL cypher mismatch error when a request is sent to it; I'd imagine this is because no SSL configuration is being picked up.

I've tried some of the examples on the internet (such as configuring Jetty from the application.properties), but that doesn't actually seem to do anything at all.

Any help appreciated, all of the routes in the project are written using the Camel Java DSL, not the XML equivalent.


回答1:


This has since been fixed. We discovered that the correct method of doing this was by configuring the embedded Jetty itself, rather than modifying the camel route. This was achievable by instantiating a JettyHttpComponent, and setting the SSLContextParameters on it.



来源:https://stackoverflow.com/questions/44043603/configure-ssl-on-camel-rest-component-using-spring-boot-with-embedded-jetty

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!