Is this a question?
I asked this over on StackOverflow but haven't gotten a response
I'm using this library to create a proxy to a server that requires certificates (cert, ca, and key). The problem is, these certs expire over time, so I need to retrieve new certificates. However, I'm unsure how to attach a new certificate to an existing proxy.
My basic setup is similar to the following:
app.use(
'/api',
proxy({
target: {
protocol: 'https:',
host: 'another.domain.com',
port: 443,
cert: cert,
ca: ca_cert,
key: key
},
secure: false,
changeOrigin: true
})
);
Is it possible to insert a middleware before the proxy() to retrieve new certs and have proxy() use the new certs? Something like
app.use(
'/api',
(req, res, next) => {
if (/* cert has expired */) {
cert = /* get new cert */
}
},
proxy({
target: {
protocol: 'https:',
host: 'another.domain.com',
port: 443,
cert: cert,
ca: ca_cert,
key: key
},
secure: false,
changeOrigin: true
})
);
Or will that not work? Can I use onProxyReq() to manipulate the certs? Or can I tear down the original proxy() instance and instantiate a new one?
Setup
- http-proxy-middleware: 0.19.0
- http-proxy-middleware configuration
- server: [email protected]
Is this a question?
I asked this over on StackOverflow but haven't gotten a response
I'm using this library to create a proxy to a server that requires certificates (
cert,ca, andkey). The problem is, these certs expire over time, so I need to retrieve new certificates. However, I'm unsure how to attach a new certificate to an existing proxy.My basic setup is similar to the following:
Is it possible to insert a middleware before the
proxy()to retrieve new certs and haveproxy()use the new certs? Something likeOr will that not work? Can I use
onProxyReq()to manipulate the certs? Or can I tear down the originalproxy()instance and instantiate a new one?Setup