Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions lib/redis-accessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,14 @@ class RedisAccessor {
? new Redis(REDIS_URL, {
...redisBaseOptions,
db: databaseNumber,
tls: {
// Required for production Heroku Redis
rejectUnauthorized: false

// Only add this configuration for TLS-enabled REDIS_URL values.
// Otherwise, it breaks for local Redis instances without TLS enabled.
...REDIS_URL.startsWith('rediss://') && {
tls: {
// Required for production Heroku Redis
rejectUnauthorized: false
}
}
})
: new InMemoryRedis()
Expand Down
11 changes: 8 additions & 3 deletions middleware/rate-limit.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,14 @@ module.exports = rateLimit({
store: REDIS_URL && new RedisStore({
client: new Redis(REDIS_URL, {
db: rateLimitDatabaseNumber,
tls: {
// Required for production Heroku Redis
rejectUnauthorized: false

// Only add this configuration for TLS-enabled REDIS_URL values.
// Otherwise, it breaks for local Redis instances without TLS enabled.
...REDIS_URL.startsWith('rediss://') && {
tls: {
// Required for production Heroku Redis
rejectUnauthorized: false
}
}
}),
// 1 minute (or practically unlimited outside of production)
Expand Down
11 changes: 8 additions & 3 deletions script/purge-redis-pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,14 @@ purgeRenderedPageCache()
function purgeRenderedPageCache () {
const redisClient = new Redis(REDIS_URL, {
db: pageCacheDatabaseNumber,
tls: {
// Required for production Heroku Redis
rejectUnauthorized: false

// Only add this configuration for TLS-enabled REDIS_URL values.
// Otherwise, it breaks for local Redis instances without TLS enabled.
...REDIS_URL.startsWith('rediss://') && {
tls: {
// Required for production Heroku Redis
rejectUnauthorized: false
}
}
})
let totalKeyCount = 0
Expand Down