Skip to content

Infinite authentication loop after updating to latest versionΒ #488

@msfjarvis

Description

@msfjarvis

I am also seeing the same problem with the following config, my cookie directive seems to already be correctly set up.

Caddy configuration

order authenticate before respond
security {
    oauth identity provider calibreweb {
        delay_start 3
        realm calibreweb
        driver generic
        client_id {$CALIBRE_WEB_POCKET_ID_CLIENT_ID}
        client_secret {$CALIBRE_WEB_POCKET_ID_CLIENT_SECRET}
        scopes openid email profile
        base_auth_url https://auth.msfjarvis.dev
        metadata_url https://auth.msfjarvis.dev/.well-known/openid-configuration
    }
    authentication portal calibreweb_portal {
        crypto default token lifetime 3600
        crypto key sign-verify default
        enable identity provider calibreweb
        trust login redirect uri domain exact books.msfjarvis.dev path prefix /
        cookie insecure off
        cookie domain books.msfjarvis.dev
        transform user {
            match realm calibreweb
            action add role user
        }
    }
    authorization policy calibreweb_policy {
        set auth url /caddy-security/oauth2/calibreweb
        allow roles user
        inject headers with claims
    }
}

https://books.msfjarvis.dev {
    log {
        output file /var/log/caddy/access-https:__books.msfjarvis.dev.log
    }
    handle /caddy-security/* {
        route {
                authenticate with calibreweb_portal
        }
    }
    @integrations {
        path /opds /opds/* /kobo /kobo/*
    }
    handle @integrations {
        reverse_proxy localhost:9027 {
            header_up X-Scheme https
            transport http {
                read_buffer 1024k
                write_buffer 1024k
            }
        }
    }
    handle {
        route {
            authorize with calibreweb_policy
            reverse_proxy localhost:9027 {
                header_up X-Scheme https
                transport http {
                    read_buffer 1024k
                    write_buffer 1024k
                }
            }
        }
    }
}

Originally posted by @msfjarvis in #486 (comment)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions