env.dev

REDIS_URL

Sensitive

The Redis connection URL following the redis:// or rediss:// (TLS) URI format. Includes authentication credentials, host, port, and database number. Used by Redis client libraries across all languages and commonly provided by Redis hosting services.

Last updated:

REDIS_URL is a single-string connection URI for Redis: redis://user:password@host:port/db for plaintext, or rediss:// (note the double 's') for TLS. The trailing /db is the numbered logical database (0–15 by default). Most clients — ioredis, redis-py, node-redis, go-redis — accept it directly, and hosted providers like Upstash, Redis Cloud, and Heroku Redis hand it to you ready to use. The scheme is the part people get wrong: 'redis://' on a TLS-only endpoint fails with a cryptic protocol or connection-reset error.

Provider
Databases
Category
redis
Set by
Set manually or provided by Redis hosting services (Redis Cloud, Upstash, etc.)
Example
rediss://default:password@redis.example.com:6380/0
Security: REDIS_URL usually embeds the password, so keep it out of source control and logs. Managed Redis should always use rediss:// (TLS); plain redis:// sends the AUTH password and your data in cleartext. Never expose Redis directly to the public internet — an unauthenticated Redis on 6379 is a well-known target for crypto-miners and data theft.
Gotcha: rediss:// vs redis:// is a one-character difference that decides whether the connection is encrypted. Upstash and most cloud Redis require rediss://; using redis:// against them fails or, worse, silently downgrades. Also remember the /N database index — forgetting it (or setting different N across services) means two apps quietly use different keyspaces.

How to set REDIS_URL

bash (TLS)

export REDIS_URL='rediss://default:password@redis.example.com:6380/0'

Node.js (ioredis)

import Redis from 'ioredis';
const redis = new Redis(process.env.REDIS_URL);

docker-compose

services:
  app:
    environment:
      REDIS_URL: redis://cache:6379/0
  cache:
    image: redis:7

Frequently Asked Questions

What is the difference between redis:// and rediss://?

rediss:// (two s's) opens a TLS-encrypted connection; redis:// is plaintext. Managed providers like Upstash and Redis Cloud require rediss://. Using the plaintext scheme against a TLS endpoint causes connection errors, and against a plaintext endpoint it sends your AUTH password unencrypted.

Was this helpful?

Stay up to date

Get notified about new guides, tools, and cheatsheets.

Browse all 242 environment variables →