Tuesday, January 27, 2015

Configure HTTPS with a self-signed certificate in Spring Boot

To configure HTTPS with a self-signed certificate in Spring Boot,

create a new keystore having a self-signed certificate as follows:

keytool -genkey -alias tomcat -keyalg RSA -keystore keystore

Copy the file to 'src/main/resources/'

and add the following properties in application.properties:

server.ssl.key-store=classpath:keystore
server.ssl.key-store-password=keystore
server.ssl.key-password=privatekey

If you run it as a jar file,

a location for keystore should be on a filesystem as follows:

server.ssl.key-store=/Users/izeye/keystore

References:
http://tomcat.apache.org/tomcat-8.0-doc/ssl-howto.html
http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#howto-configure-ssl

No comments:

Post a Comment