Skip to content

[Turbo] Multiple hubs Mercure but first used with credentials #3128

@ytilotti

Description

@ytilotti

I have this mercure configuration:

mercure:
    hubs:
        hub1:
            url: 'https://mercure.domain.local1/.well-known/mercure'
            public_url: 'https:///mercure.domain.local1/.well-known/mercure'
            jwt:
                secret: '%env(string:MERCURE_JWT_SECRET)%'
                publish: '*'
        hub2:
            url: 'https://mercure.domain.local2/.well-known/mercure'
            public_url: 'https:///mercure.domain.local2/.well-known/mercure'
            jwt:
                secret: '%env(string:MERCURE_JWT_SECRET)%'
                publish: '*'

In twig, I can use this following code:

{{ turbo_stream_listen('App\\Entity\\Book', 'hub1', { withCredentials: true }) }}

But can't use:

{{ turbo_stream_listen('App\\Entity\\Book', 'hub2', { withCredentials: true }) }}

I have the error:
Unable to create authorization cookie for a hub on the different second-level domain mercure.domain.local1

The system behind turbo_stream_listen use the first hub (transport) of the configuration and not the hub assigned in the function to create the cookie of Mercure Authorization.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions