How to add self signed SSL certificate to jHipster sample app?
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.
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.
Related reading
- How to add SSL certificate to AWS EC2 with the help of new AWS Certificate Manager service
- How to add users to Docker container?
- How to allow a User only access their own data in Spring Boot / Spring Security?
- How to allow all Network connection types HTTP and HTTPS in Android 9 Pie?
- How to allow my user to reset their password on Cognito User Pools?
- How to assign IAM role to users or groups
- How to authenticate/authorize a consumer in Kafka for a topic before it consumes the message
- How to avoid buffer overflow on asynchronous non-blocking WSASend calls

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.