Umi: [Bug] Cannot use custom HTTPS cert and key

Created on 4 Nov 2020  ·  4Comments  ·  Source: umijs/umi

What happens?

When trying to use custom cert and key for https, I added https: { key: "./localhost-key.pem", cert: "./localhost-cert.pem" } to .umirc. Umi throws the following error

Invalid config keys: https

Mini Showcase Repository(REQUIRED)

https://github.com/khalibloo/umi-https-bug

How To Reproduce

Steps to reproduce the behavior:

  1. add https config to .umirc.ts and set environment variable HTTPS=1
  2. start dev server

Expected behavior

  1. Dev server should have started in https mode, using custom cert and key

Context

  • Umi Version: 3.2.24
  • Node Version: 12.19.0
  • Platform: Windows 10 x64
type(bug)

All 4 comments

hi @khalibloo try this into .umirc.ts file

devServer:{
    https: { key: "./localhost-key.pem", cert: "./localhost-cert.pem" }
},

That worked wonders! Thanks.

It was this part of the documentation that misled me https://umijs.org/docs/env-variables#https Needs to be updated.

Your welcome!
Yes, documentation it's poor... had the same problem and i found into src\.umi\core\pluginConfig.d.ts how to overwrite some configurations

I thought there was an issue with my intellisense, but now that you mention it, I checked and the typings aren't properly set for .umirc.ts defineConfig. The type is set to any. There is no point using defineConfig anymore.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

zemzheng picture zemzheng  ·  3Comments

nguyenhuutinh picture nguyenhuutinh  ·  3Comments

afc163 picture afc163  ·  3Comments

haiing picture haiing  ·  3Comments

y2891663091 picture y2891663091  ·  4Comments