How to configure an HTTPS endpoint in Anypoint Studio

https
Mulesoft
MuleSoft
Developer Relations
10 min read
Overview

In the previous article, we learned how to develop, test, and deploy our first Mule Application. In this tutorial, we are going to learn how to configure TLS with a Keystore to enable HTTPS on our Mule Application.

Build an HTTPS Service

In order to enable HTTPS on your localhost and CloudHub endpoint, you need to generate a keystore.jks file using the JDK keytool utility on the command line. You must also specify the hostname on the command line to generate a self-signed certificate.

Go to your Terminal or Command line, and type in the following command to generate your keystore.jks file. You need to save your keystore file in your Anypoint Studio Mule applications src/main/resources folder. If you CD into your folder before running the below command, it will generate the file right into your folder.

keytool -genkeypair -keystore keystore.jks -keypass password -storepass password -keyalg RSA -sigalg SHA1withRSA -keysize 2048 -alias mule

For more information and details on how to generate your keystore, please click here to go to the MuleSoft Documention.

Next, go into Anypoint Studio, and select your HTTP Listener and click on the Connector Configuration. Select the Protocol to HTTPS and switch your port to 8082. Then, under the TLS tab enter your keystore path, alias and password. Make sure that you enter the same credentials as you defined in the above command when generating the keystore.

8082https

Click the Test Connection button to verify that you have setup your keystore configuration properly.

Test your HTTPS enabled Mule Application

Once you have configured your keystore configuration, go to your REST client such as Postman, and enter in the endpoint of your Mule Application. Don’t forget to include HTTPS in the URL and the correct port 8082. When you make a POST request to your Hello Mule application using HTTPS, it should return with a 200 OK response. If your request fails, make sure that you have SSL certification verification turned off in Postman or your other favorite REST client.

hello mule postmanhello mule postman 2
Congratulations on configuring HTTPS

You did it! You successfully configured HTTPS in your Mule Application. In the next article, we will show you how to secure properties for deployment. If you found this tutorial helpful, please give it a rating below.

Try Anypoint Platform for free

Start free trial

Already have an account? Sign in.

Related tutorials