apache nodejs uniqueid

Have a unique id header, generated by apache, in every request.

To install :

a2enmod unique_id

add this in the vhost

RequestHeader set uniqueid %{UNIQUE_ID}e

if you want to see the id in apache logs add this variable somewhere %{uniqueid}i

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{uniqueid}i\"" combined 


apachectl restart

check working in your server (express exemple) :

const express = require('express')
const app = express()
const port = 3000

app.get('/', function(req, res, next) {
        headers: req.headers,

app.listen(port, () => console.log(`Example app listening at http://localhost:${port}`))

curl https://localhost:3000

    headers: {
        x-request-id: "XohS7H8AAQEAAG2BCU0AAAAE",