Configure HTTPS Endpoint for Mule Applications – One Way SSL

Author: Kuldeep Rana

This article will learn about how to configure a TLS with a Keystore to enable HTTPS for our Mule application.

Before building our HTTPS application, we need to know what basically is an HTTPS connection, Keystore, and Truststore?

HTTPS (Hypertext Transfer Protocol Secure) is an internet communication protocol that protects data integrity and confidentiality between the user’s computer and the site. Users expect a secure and private online experience when using a website.

Keystore basically stores your private keys and certificates and is needed when you are setting up the server-side on the SSL.

Truststore is used to store certificates from certified authorities, which verify whether the certificates or private keys present at the server’s end are valid to set up an SSL connection.

Creating a Keystore for our application 

The first thing to set up an HTTPS connection for your application, you need to generate the keystore.jks file using the JDK Toolkit on the command line to generate a self-signed certificate.

Navigate to the place you have installed your jdk. Inside bin run the following command :

keytool -genkey -keyalg RSA -keystore <location of file>/<filename>

As soon as you run the command, you will be asked to enter a password. Remember this password as this will be used to configure the TLS connection for our mule application.

Once you enter the password, you will be asked some general questions shown in the image below. Feel free to answer them accordingly.

Once the enter everything, the .jks file will be generated at the mentioned location of the command that we ran.

Building an HTTPS  Application

  • Create a sample mule application for your HTTPS service.
  • Place the keystore.jks file generated in the src/main/resources folder of your project.
  • Select your Http listener and click on connector configurations.
  • Select the protocol as HTTPS and switch on to port 8082.
  • Choose the TLS tab. In the drop-down menu that appears, Select Edit inline.
  • In the KeyStore configuration that appears, enter the Type, Path, Keypassword, and Password.
  • Click the Test Connection button to verify that you have set up the Keystore configurations properly.

Test your application using Postman

Once you have configured your Keystore configuration, go to your Postman and enter your Mule Application’s endpoint. Don’t forget to include HTTPS in the URL and the correct port 8082.

When you make a GET request to your Mule application using HTTPS, it should return with a 200 OK response.

If your request fails, ensure that you have SSL certification verification turned off in Postman or your other favorite REST client.

We use cookies on this site to enhance your user experience. For a complete overview of how we use cookies, please see our privacy policy.