flask-request-id-header
Python Flask middleware to ensure all requests have a request ID header
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-headeruv
uv add flask-request-id-headerpoetry
poetry add flask-request-id-headerInstalling 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
Tags
More Dynamic Content packages
MarkupSafe provides a text object that escapes…
permissive · top 100 on PyPI
Jinja2Jinja2 is a templating engine that renders…
permissive · top 100 on PyPI
soupsieveSoupsieve is a CSS selector library designed to…
permissive · top 100 on PyPI
WerkzeugWerkzeug is a WSGI utility library providing…
permissive · top 1,000 on PyPI
FlaskFlask is a lightweight WSGI web application…
permissive · top 1,000 on PyPI
MakoMako compiles Python-embedded templates into…
permissive · top 1,000 on PyPI
django-request-idAttaches a unique request ID to each Django…
permissive · top 15,000 on PyPI
asgi-correlation-idASGI middleware that reads or generates…
permissive · top 5,000 on PyPI
Flask-Log-Request-IDExtracts request IDs from incoming HTTP…
permissive · top 15,000 on PyPI
django-log-request-idAttaches a unique request ID to every log…
permissive · top 15,000 on PyPI
starlette-contextMiddleware for Starlette that stores and…
permissive · top 5,000 on PyPI
opencensus-ext-flaskAdds distributed tracing instrumentation to…
permissive · top 15,000 on PyPI
opentelemetry-instrumentation-flaskAdds distributed tracing to Flask web…
permissive · top 1,000 on PyPI
flask-talismanFlask extension that automatically sets HTTP…
permissive · top 5,000 on PyPI
flask-corsFlask-CORS handles Cross-Origin Resource…
permissive · top 1,000 on PyPI
django-guidAttaches a unique correlation ID to all logs…
permissive · top 15,000 on PyPI