umi.js proxy设置https请求不验证证书-- 解决SELF_SIGNED_CERT_IN_CHAIN

在使用Ant Design Pro时候,服务器端使用了自己keytool生成的证书,在config/config.js
设置代理请求的时候报错:

[HPM] Error occurred while trying to proxy request /myapi/user/login 
from localhost:8000 to https://localhost:8443 
(SELF_SIGNED_CERT_IN_CHAIN)
(https://nodejs.org/api/errors.html#errors_common_system_errors)

解决方法:

  proxy: {
    '/myapi': {
      target: 'https://localhost:8443',
      changeOrigin: true,
      secure: false, // 不进行证书验证
    },

参考https://github.com/webpack/webpack-dev-server/issues/866

你可能感兴趣的:(解决方法)