How to add self signed SSL certificate to jHipster sample app?
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
Adding a self signed SSL certificate to a jHipster app is common for local development, staging demos, and internal test environments. The main steps are generating a keystore, configuring Spring Boot HTTPS properties, and trusting the certificate in client systems. Keep in mind that self signed certificates are for non production use unless your organization controls trust distribution.
Generate a Self Signed Keystore
You can create a PKCS12 keystore with Java keytool.
This command creates a keystore file your app can load at startup.
Configure HTTPS in jHipster Spring Settings
Add SSL settings in the active profile YAML file, such as application-dev.yml.
If you keep both HTTP and HTTPS, ensure reverse proxy or frontend config points to the secure port for API calls.
Redirect HTTP to HTTPS for Local Validation
To test secure only behavior, add redirect configuration in Spring Security or proxy config. In many dev setups, keeping only HTTPS port is simpler and avoids mixed content issues.
For frontend apps served separately, update API base URL to https://localhost:8443.
Trust the Certificate in Browser and Tools
A self signed certificate is not trusted automatically by browsers or API tools. Export the certificate and import it into your local trust store.
Use this file for local browser trust, Postman certificate trust, or internal client setup.
Verify HTTPS End to End
Run the app and validate certificate details:
If handshake succeeds and health endpoint responds, SSL setup is functioning.
Import Certificate into Java Truststore for Local Clients
If local Java clients call your jHipster service, they may reject the self signed certificate unless trusted. Import the exported certificate into a dedicated truststore for development.
Then run the client with truststore settings:
This keeps local trust configuration explicit and avoids disabling SSL validation in code.
Keep Secrets Outside Source Control
Keystore files and passwords should not be hard coded in tracked repository config. Use environment variables for password values and keep local keystore artifacts ignored by Git.
This is safer and mirrors production style secret handling even in development setups.
Common Pitfalls
A common mistake is generating a certificate with CN that does not match the host used in browser requests. Hostname mismatch warnings then appear.
Another issue is using the wrong keystore path prefix. classpath: paths must point to packaged resource locations.
A third issue is committing sensitive keystore passwords directly in public configuration files. Use environment overrides for shared repositories.
Summary
- Generate a local keystore with
keytoolfor development SSL. - Configure Spring Boot SSL properties in jHipster profile files.
- Export and trust the certificate for local clients.
- Verify handshake and endpoint access with curl and OpenSSL.
- Use self signed certs only for controlled non production contexts.

