Skip to content

Restore Redis DSN support for session storage - #2218

Open
melroy89 wants to merge 2 commits into
mainfrom
fix/redis-session-dsn
Open

melroy89 wants to merge 2 commits into
mainfrom
fix/redis-session-dsn

Conversation

@melroy89

@melroy89 melroy89 commented Sep 9, 2026

Copy link
Copy Markdown
Member

Summary

Reuse Symfony's existing DSN-backed Redis provider for session storage instead of creating a second connection from mandatory REDIS_HOST and REDIS_PORT variables.

This restores support for all existing REDIS_DNS connection forms, including Unix sockets, while keeping TCP, authentication, and Docker configurations on the same canonical setting.

Additional information

PR #2127 added Redis-backed session storage but created a separate Redis service that requires REDIS_HOST and REDIS_PORT. That made previously valid Unix-socket configurations fail during environment-variable resolution, even though REDIS_DNS remained configured as Symfony's default Redis provider.

RedisSessionHandler now receives cache.default_redis_provider, which Symfony builds through its Redis DSN connection factory. The redundant host and port variables are removed from the environment templates.

Related issues

Follow-up to #2127.

@melroy89 melroy89 added the backend Backend related issues and pull requests label Sep 9, 2026
@melroy89
melroy89 requested a review from blued-gear September 9, 2026 17:34
@melroy89
melroy89 marked this pull request as ready for review September 13, 2026 13:33
@BentiGorlich

Copy link
Copy Markdown
Member

If it works, this is awesome. I didn't find a solution to stay on the dsn variable...

@melroy89

Copy link
Copy Markdown
Member Author

If it works, this is awesome. I didn't find a solution to stay on the dsn variable...

Yes indeed. So we basically reuse the default redis provider variables documented here as well https://symfony.com/doc/current/cache.html#configuring-cache-with-frameworkbundle

@melroy89

melroy89 commented Sep 14, 2026

Copy link
Copy Markdown
Member Author

And yes this should work again for both TCP DNS and socket DNS. Since the default_redis_provider resolves from %env(REDIS_DNS)%. I tested it already.

see:

default_redis_provider: '%env(REDIS_DNS)%'

Symfony’s framework config then uses that provider here: vendor/symfony/framework-bundle/Resources/config/cache.php:139 (see locally on disk if you have executed composer install):

  'provider' => 'cache.default_redis_provider',

Please approve.

@melroy89
melroy89 enabled auto-merge (squash) September 14, 2026 20:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend Backend related issues and pull requests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants