skillfed

flask-request-id-header

Python Flask middleware to ensure all requests have a request ID header

flask-request-id-header v0.1.1 101.7K downloads/30d#12,921 on PyPI9
License unclear Open Government Licence v3.0 Abandoned released

What it is and what it does

Flask Request ID Header is a lightweight middleware that ensures every HTTP request to a Flask application carries a unique X-Request-ID header. If a request arrives without one, the middleware generates a UUID v4 and adds it; if one exists but lacks a UUID v4 value, the middleware appends one. This enables request tracing across microservices, load balancers, and reverse proxies—critical for correlating log entries and debugging distributed systems.

The middleware integrates directly into Flask's request handling with no required configuration. It exposes the current request ID via the request environment (HTTP_X_REQUEST_ID) so your application code can access it for logging or forwarding. You can optionally set a REQUEST_ID_UNIQUE_VALUE_PREFIX config to treat certain prefixed IDs as already unique, preventing unnecessary appends. The package is minimal and stable but unmaintained since 2019.

Use it for:

  • Trace a single user request through multiple microservices by including the X-Request-ID in logs at each layer.
  • Correlate errors in a load-balanced Flask deployment by extracting the request ID from response headers.
  • Include request IDs in application logs using a custom logging formatter to link log entries to specific user actions.
  • Pass request IDs downstream to external APIs or databases to maintain end-to-end request context in distributed systems.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Flask middleware that automatically adds or validates an X-Request-ID header on all incoming requests, enabling request tracing through distributed systems.

Yes, if you need a minimal, zero-configuration request ID middleware for a Flask application and can accept that the package is unmaintained. It has no known vulnerabilities, low install friction, and a simple, stable API. No, if you require active maintenance, support for recent Flask versions, or a more feature-rich tracing solution. Verify the Open Government Licence v3.0 is acceptable for your use case.

Install

flask-request-id-header on PyPI

pip

pip install flask-request-id-header

uv

uv add flask-request-id-header

poetry

poetry add flask-request-id-header

Installing flask-request-id-header

Before you install

Installation is straightforward with low friction—only flask as a runtime dependency. However, the package is abandoned: last release was 2019-03-02, last commit 2022-12-27, and no maintenance activity since. Use only if you need a minimal, stable request ID middleware and can maintain it yourself if needed.

License in practice

Licensed under Open Government Licence v3.0 with unclear SPDX mapping. Verify compatibility with your project's license requirements before use, particularly in proprietary or commercial contexts.

Quickstart

pip install flask-request-id-header

from flask import Flask
from flask_request_id_header.middleware import RequestID

app = Flask(__name__)
RequestID(app)

@app.route('/')
def hello():
    return 'hello'

Verify before relying

  • Whether Open Government Licence v3.0 is compatible with your project's licensing model
  • Whether the package works with current Flask versions (last tested in 2019)
  • Whether UUID v4 generation for request IDs meets your security and uniqueness requirements

Package facts

License Open Government Licence v3.0 (unclear)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies 1 — flask
Maintenance abandoned — 2,722 days since the last release
Last repo commit
First released
Downloads 101,696/month — #12,921 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: flask_request_id_header-0.1.1-py3-none-any.whl

Development Status :: 5 - Production/StableFramework :: FlaskIntended Audience :: DevelopersLicense :: Other/Proprietary LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3

Tags

flask request id middlewarecorrelation id tracking flaskx-request-id headerrequest tracing flaskdistributed request tracking
request-tracingmiddlewarecorrelation-ids

More Dynamic Content packages