Skip to content

Authorization header 'bearer' (lower case) is rejected #261

Closed

Description

@mcollina

src/auth/prehandler.ts checks authHeader.startsWith('Bearer '). The auth-scheme is case-insensitive (RFC 7235 §2.1, RFC 6750 §2.1), so a client sending bearer <token> or BEARER <token> with a valid token gets 401 invalid_token ("must use Bearer scheme").

Repro

The same valid JWT: Authorization: Bearer <jwt> → 200, Authorization: bearer <jwt> → 401.

Suggested fix

Match the scheme case-insensitively, e.g. /^bearer +(\S+)$/i.

Found during the round-7 review of #170; also on main.

🤖 Generated with Claude Code

Activity

  1. added a commit that references this issue on Oct 14, 2026
    174d8d0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions