1

I am new to Helidon, and we want our Java app to support HTTPS for REST calls. I have a sample controller that returns some string, and my app currently runs on http://localhost:8080. How can I enable HTTPS and configure SSL?

Sample controller:

@Path("/test")
@ApplicationScoped
public class TestEndpointController {

    @GET
    public Response executeRule() {
        return Response.status(200).entity("Working").build();
    }
}

Here's what I tried: Generated self signed certificate and configured it in the application.yaml file:

server:
 port: 8080
  host: 0.0.0.0
  ssl:
    private-key:
      keystore-resource-path: "keystore.p12"
      keystore-passphrase: "changeit"
  experimental:
    http2:
      enable: true
      max-content-length: 16384

Command used to generate cert keytool -genkeypair -alias localhost -keyalg RSA -keysize 2048 -storetype PKCS12 -keystore keystore.p12 -validity 365

But when I try to hit the endpoint with https I am getting below error This site can’t provide a secure connection

4
  • edit the question and add a minimal reproducible example.
    – aled
    Commented Jul 11 at 15:46
  • @aled I have added the necessary details.
    – NotACat
    Commented Jul 11 at 15:51
  • A startup log trace showing the starting of tls on port 8080 would be helpful. Commented Jul 11 at 16:19
  • What version of Helidon are you using? The config in your question may be old - see Configuring TLS in the Config File - from the v4.0 documentation. (Also, I think http2 is no longer "experimental" in Helidon). Commented Jul 11 at 16:35

1 Answer 1

0

Your config seems to be Helidon 2.x syntax, is that a desired version you want to use?(latest is 4.x).

4.x https://github.com/helidon-io/helidon/tree/4.0.11/examples/microprofile/tls https://helidon.io/docs/v4/se/webserver#_configuring_tls

2.x https://github.com/helidon-io/helidon/tree/2.6.7/examples/microprofile/tls https://helidon.io/docs/v2/mp/jaxrs/02_server-configuration

server:
  tls:
    #Truststore setup
    trust:
      keystore:
        passphrase: "password"
        trust-store: true
        resource:
          resource-path: "keystore.p12"
    #Keystore with private key and server certificate
    private-key:
      keystore:
        passphrase: "password"
        resource:
          resource-path: "keystore.p12"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.