webpack devserver代理到https,给出“尝试代理请求时发生错误”和SELF_SIGNED_CERT_IN_CHAIN

时间:2020-06-20 05:43:20

标签: webpack

尝试从本地主机设置代理到http s 站点时看到以下错误

[HPM] Error occurred while trying to proxy request /api/analytics/getDataByPage from localhost:8080 to https://example.com:19502 (SELF_SIGNED_CERT_IN_CHAIN) (https://nodejs.org/api/errors.html#errors_common_system_errors)

1 个答案:

答案 0 :(得分:0)

设置,secure: false解决了该问题:

proxy: [
  {
    context: ["/api/**"],
    secure: false, // had an expression which was resolving to true
    changeOrigin: true,
  }
]