I have create sample jHipster app. Now I want to add self signed SSL certificate and test in local to have a access to https. How to achieve this?
To extend the Driss Amri brilliant answer on how to re-enable BrowserSync.
If you choose not to support http, or if http is redirected to https, BrowserSync will not work. To make it work again, few changes are necessary in:
gulp/config.js, apiPort and uri to:
apiPort: 8443,
uri: 'https://localhost:',
gulp/serve.js: add options.rejectUnauthorized = false; into proxyRoutes so that node does not complain about self signed certificate:
proxyRoutes.map(function (r) {
var options = url.parse(baseUri + r);
options.route = r;
options.preserveHost = true;
options.rejectUnauthorized = false;
return proxy(options);
}));
optionally let BrowserSync serve content over https too. I recommend it with Spring Social to save some trouble. Just add https: true into browserSync call in gulp/serve.js:
browserSync({
open: true,
port: config.port,
server: {
baseDir: config.app,
middleware: proxies
},
https: true
});
Now BrowserSync will serve content with self signed certificate shipped with it. It is possible to reuse the one created for Spring Boot, more on BrowserSync homepage.