http-proxy-middleware刷新证书

时间:2018-11-05 20:02:04

标签: express http-proxy client-certificates http-proxy-middleware

在我的Express服务器中,我有一个http-proxy-middleware设置,该设置使用如下证书:

const proxy = require('http-proxy-middleware');
const cert = fs.readFileSync('/path/to/cert');
const ca_cert = fs.readFileSync('/path/to/ca_cert');
const key = fs.readFileSync('/path/to/key');
app.use(
  '/api',
  proxy({
    target: {
      protocol: 'https:',
      host: 'another.domain.com',
      port: 443,
      cert: cert,
      ca: ca_cert,
      key: key
    },
    secure: false,
    changeOrigin: true
  })
);

问题是,我的证书会在一段时间后过期,并且服务器上的证书将自动刷新,因此我想重新获取证书。因此,我可以做一个setInterval()来重新读取证书,但是如何获得http-proxy-middleware来使用更新的证书?

0 个答案:

没有答案
相关问题