Skip to content

JWT Audience mismatch when running two instances for the same top level domain on seperate hosts #18

@fightforlife

Description

@fightforlife

Hi there,

I just migrated from the no longer maintainend forward auth to this one, Thanks very much for your work.

I have a quite specific issue:

Currently I have two docker hosts running under the same domain.com.
Both of them have a forward-auth instances configured with the same secret and same Cookiedomain=domain.com
The only difference is the forward-auth hostname, auth.subone.domain.com and auth.subtwo.domain.com..

I want both forward-auths to create a valid cookie for both hosts. (That is why they have the same secret).
The problem is, that the generated JWT includes the auth host as audience!

When a user visits auth.subone.domain.com the JWT is generated with auth.subone.domain.com as audience.
If the user now switches to auth.subtwo.domain.com, there he gets a HTTP500 Error because the audience in the JWT does not match the hostname of the forward-auth.
If he reloads the page the HTTP500 is gone and the JWT is regenerated with the new audience.
If he switches back to a service on auth.subone.domain.com, he has the problem again.

Would it be possible to set the audiences of the jwt to the Cookiedomain?
Or make it configurable to add custom domains?

In my head it sounds as easy as replacing the host with the cookiedomain here:

jwt.WithAudience(cfg.Hostname),

But most likely there are dependencies that I not know of.

Best regards!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions