Skip to content

Unable to use redis sessions with AWS Elasticache #81

@zwilias

Description

@zwilias

Description

AWS Elasticache, like most cloud-based redis offerings, run in secure mode, which effectively disables the CONFIG command. However, the JedisConnectionFactory as configured in WEB-INF/applicationContext-session-redis.xml will attempt to use the CONFIG command to enable keyspace notifications.

Priority

Low

Resolution

I have no budget and there's no rush, please add this feature for free

More information

We are working around this particular issue by replacing the applicationContext-session-redis.xml with the following in our war:

<?xml version="1.0" encoding="UTF-8"?>
<beans
    xmlns="http://www.springframework.org/schema/beans"
    xmlns:util="http://www.springframework.org/schema/util"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:p="http://www.springframework.org/schema/p"
    xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
        http://www.springframework.org/schema/context
        https://www.springframework.org/schema/context/spring-context.xsd
        http://www.springframework.org/schema/util
        http://www.springframework.org/schema/util/spring-util.xsd">
    <context:annotation-config />
    <bean class="org.springframework.session.data.redis.config.annotation.web.http.RedisHttpSessionConfiguration" p:configureRedisAction-ref="configureRedisAction" />
    <util:constant id="configureRedisAction" static-field="org.springframework.session.data.redis.config.ConfigureRedisAction.NO_OP"/>
    <bean name="jedisConnectionFactory" 
        class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory"
        p:hostName="${structurizr.redis.host}" 
        p:port="${structurizr.redis.port}" 
        p:password="${structurizr.redis.password}" />
</beans>

This works, though ideally something like structurizr.redis.secure to toggle this behaviour would be quite a bit more ergonomic, much like spinnaker offers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions