How to add self signed SSL certificate to jHipster sample app?

后端 未结 3 834
误落风尘
误落风尘 2020-12-04 09:04

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?

3条回答
  •  盖世英雄少女心
    2020-12-04 09:27

    For those using webpack instead of gulp you can complete Driss Amri's answer with two changes:

    modify the proxy.conf.json:

    {
        "*": {
            "target": "https://localhost:8443",
            "secure": true
        }
    }
    

    this will redirect API requests to the new https address. Then alter also webpack file for instance here a webpack.dev.js modified example:

    module.exports = webpackMerge(commonConfig({ env: ENV }), {
    devtool: 'eval-source-map',
    devServer: {
        contentBase: './target/www',
        proxy: [{
            context: [
                /* jhipster-needle-add-entity-to-webpack - JHipster will add entity api paths here */
                '/api',
                '/management', ...
                '/auth'
            ],
            target: 'https://127.0.0.1:8443',
            /* set secure to false here, otherwise self-signed certification cause DEPTH_ZERO_SELF_SIGNED_CERT proxy errors */
            secure: false
        }]
    },
    

提交回复
热议问题