I dont seem to be able to connect to Heroku Redis using TLS on Node.
These docs arent really much help: https://devcenter.heroku.com/articles/securing-heroku-redis
Does anyone have a working example? Should I be using REDIS_URL or REDIS_TLS_URL?
Im using node_redis v3
6
Answers
I don’t know why you can’t connect to this Redis Add-on unfortunately.
In the event you want to test on another Add-On, I have developped a Redis Add-On that is in the "alpha" phrase (free) on Heroku. I’ll be able to provide you some support if you can’t connect to it.
If you are interested, give me your Heroku email in private and I’ll send you an invitation 🙂
I found the Redis 6 add-on by Heroku generated an
Error: self signed certificate in certificate chain
error when when connecting to REDIS_URL without any parameters with ioredis on Node. You can avoid this error by passing in TLS options withrejectUnauthorized
set tofalse
.The
rejectUnauthorized
offalse
allows for self-signed certificates, which would be an issue if concerned about MITM attacks. See TLS options for more background.This is working for me with the latest
ioredis
package with rediss:// and redis:// URL’s…Here’s my approach. It’s easier to pass URL and TLS options separately.
If you have test env running with hobby version, the TLS is URL is set in REDIS_TLS_URL, while production normally runs with premium and the env is REDIS_URL. So, to be compatible with the both, I first look for REDIS_TLS_URL and after that REDIS_URL to support both test and prod env.
For devs using
node-redis
, you’ll need to set TLS to true when initializing your client.For people using Bull, this implementation worked for me. Thanks @Tom McLellan.
This worked for me using
node-redis
v3.0.0Use
tls
notsocket
. Thanks to this.