Skip to content

x-request-id header not echoed in HTTP Gateway responses #361

@Verolop

Description

@Verolop

Problem

When sending an x-request-id header through SpiceDB's HTTP gateway, the request ID is processed internally but not returned in the HTTP response headers, breaking standard HTTP patterns.

Current Behaviour

Response headers contain: Grpc-Metadata-Io.spicedb.respmeta.requestid: test-123, yet, response headers are still missing: x-request-id: test-123

Investigation

SpiceDB's request ID middleware uses requestmeta.RequestIDKey and responsemeta.RequestID from this lib.
In commit 34b8159 we added RequestIDKey using the standard x-request-id header. However, responsemeta.RequestID still uses the old custom key io.spicedb.respmeta.requestid.
This means requests use the std header but responses use a custom one. Hence, we would have to add a custom header translation in SpiceDB's grpc gateway to deal with this. Instead, let's update responsemeta.RequestID to x-request-id.

Note: This will be a small breaking change for any code that hardcodes io.spicedb.respmeta.requestid instead of using the responsemeta.RequestID constant. Once we release a new version of authzed-go, we can open a PR in SpiceDB to include these changes.

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