Skip to content

config.dev.https should map to devWebpackConfig.devServer #1217

@bird-cage

Description

@bird-cage

The BUG or rather the missing feature
I was unable to view my dev instance with https even though I'd set config.dev.https: true.
It did work when I added --https to the package.json scripts.dev cli options
After looking around I seen that in ./build/webpack.dev.config.js where the Promise for the server is defined, config.dev.https was not being read into const: devWebpackConfig.devServer

The FIX
In ./build/webpack.dev.config.js under the lines:
host: process.env.HOST || config.dev.host,
port: process.env.PORT || config.dev.port,
I added:
https: config.dev.https ? config.dev.https: false,

Now all works for me as expected
This should be fixed ;-)

P.S. as an additional tip
for somebody tackling using https with the webpack dev proxy server like me, be sure to not only set:
proxyTable.target = 'https://yourOtherServersDomain[:andPortIfRequired]'
BUT ALSO
proxyTable.secure = false This may only be necessary if it's an self-signing key, which it is in my case

The errors I seen which could help somebody find this when:
devServer.https not set
Browser:
This site can’t be reached

devServer is running with https but proxyTable.secure != false
Terminal:
[HPM] Error occurred while trying to proxy request /webshop/product/lottonormal from xxxx:8080 to https://xxxxxx.dev.local:24910 (UNABLE_TO_VERIFY_LEAF_SIGNATURE) (https://nodejs.org/api/errors.html#errors_common_system_errors)
Chrome network dev Tab:
Headers status code 500

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions