Skip to content

Option to disable 'request-id' header #4192

@philippviereck

Description

@philippviereck

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the feature has not already been requested

🚀 Feature Proposal

Add a option to disable requestIdHeader overwriting genReqId

Motivation

As far as I understand, fastify will by default use the value of the requestIdHeader,if such a header is present in the request, over the genReqId value.

Now, one does not necessarily know that a server is a fastify server, and one can change (obfuscate) the header key, but essentially a malicious actor could pass the same request-id for all requests and therefore reduce the quality of the logs. If one is trying to investigate an incident multiple requests now share the same id.

This is of low impact I'd assume, still I think it would be nice to disable this behaviour in a proper way instead of relying on obfuscation.

Example

const fastify = require('fastify')({
  requestIdHeader: false // (disabled instead of default value)
})

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