Hey @hassy, we use some self-signed certs for some of our staging servers.
At the moment, requests are (rightfully) rejected as being untrusted when requesting an HTTPS endpoint. I can hack around this by setting process.env.NODE_TLS_REJECT_UNAUTHORIZED directly, but that's pretty lame. I'd also want this to be able to be configured per environment so in staging I can use unsafe connections, but closer to and in production we'd want to actually have a secure connection.
It would be nice if we could pass in a config option that allowed the rejectUnauthorized property to be passed to the underyling https.request.
Looks good @kjgorman :+1: request isn't going anywhere any time soon and this is a needed feature. Could you add a test (a simple one will do), and send a PR? :fireworks:
Hey @hassy, we use some self-signed certs for some of our staging servers.
At the moment, requests are (rightfully) rejected as being untrusted when requesting an HTTPS endpoint. I can hack around this by setting
process.env.NODE_TLS_REJECT_UNAUTHORIZED
directly, but that's pretty lame. I'd also want this to be able to be configured per environment so in staging I can use unsafe connections, but closer to and in production we'd want to actually have a secure connection.It would be nice if we could pass in a config option that allowed the
rejectUnauthorized
property to be passed to the underylinghttps.request
.Just passing config all the way through to the request like this: https://github.com/kjgorman/minigun-core/commit/f8b06c8f2618e182771f6461ff406c969e83a9f3 will work, but is pretty brittle with respect to the request implementation (especially given https://github.com/artilleryio/minigun/issues/6).
It also maybe generalises beyond just this setting/use case to how you can configure other properties of the request.
What do you reckon?