File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,9 +26,14 @@ class RedisAccessor {
2626 ? new Redis ( REDIS_URL , {
2727 ...redisBaseOptions ,
2828 db : databaseNumber ,
29- tls : {
30- // Required for production Heroku Redis
31- rejectUnauthorized : false
29+
30+ // Only add this configuration for TLS-enabled REDIS_URL values.
31+ // Otherwise, it breaks for local Redis instances without TLS enabled.
32+ ...REDIS_URL . startsWith ( 'rediss://' ) && {
33+ tls : {
34+ // Required for production Heroku Redis
35+ rejectUnauthorized : false
36+ }
3237 }
3338 } )
3439 : new InMemoryRedis ( )
Original file line number Diff line number Diff line change @@ -19,9 +19,14 @@ module.exports = rateLimit({
1919 store : REDIS_URL && new RedisStore ( {
2020 client : new Redis ( REDIS_URL , {
2121 db : rateLimitDatabaseNumber ,
22- tls : {
23- // Required for production Heroku Redis
24- rejectUnauthorized : false
22+
23+ // Only add this configuration for TLS-enabled REDIS_URL values.
24+ // Otherwise, it breaks for local Redis instances without TLS enabled.
25+ ...REDIS_URL . startsWith ( 'rediss://' ) && {
26+ tls : {
27+ // Required for production Heroku Redis
28+ rejectUnauthorized : false
29+ }
2530 }
2631 } ) ,
2732 // 1 minute (or practically unlimited outside of production)
Original file line number Diff line number Diff line change @@ -44,9 +44,14 @@ purgeRenderedPageCache()
4444function purgeRenderedPageCache ( ) {
4545 const redisClient = new Redis ( REDIS_URL , {
4646 db : pageCacheDatabaseNumber ,
47- tls : {
48- // Required for production Heroku Redis
49- rejectUnauthorized : false
47+
48+ // Only add this configuration for TLS-enabled REDIS_URL values.
49+ // Otherwise, it breaks for local Redis instances without TLS enabled.
50+ ...REDIS_URL . startsWith ( 'rediss://' ) && {
51+ tls : {
52+ // Required for production Heroku Redis
53+ rejectUnauthorized : false
54+ }
5055 }
5156 } )
5257 let totalKeyCount = 0
You can’t perform that action at this time.
0 commit comments