Skip to content
nginx-uuid4-module is a nginx module to generate version-4 UUIDs.
Branch: master
Clone or download
Pull request Compare This branch is even with cybozu:master.
Type Name Latest commit message Commit time
Failed to load latest commit information.
mt19937 Initial version. Nov 17, 2015
LICENSE Initial version. Nov 17, 2015 Update README to support dynamic module. Nov 6, 2018
config Added support for usage as dynamic module Oct 23, 2018
ngx_http_uuid4.c Initialize MT after fork. Dec 8, 2015


nginx-uuid4-module provides a directive to set version-4 UUIDs for variables.

This module randomly generates UUID by Mersenne twister. You can use the UUID as an unique identifier for an HTTP request.

NOTE: You should not treat these UUIDs as secret credentials because an attacker can predict subsequent UUIDs by observing past UUIDs.

Example configuration

http {
    # Set a random UUID to $request_id.
    uuid4 $request_id;
    # Output the $request_id to our access log.
    log_format combined "$remote_addr ... $http_user_agent $request_id";

In this example, $request_id contains a UUID string such as b4c3a954-8403-4da2-9f7a-aecc9a98b28f.



Syntax: uuid4 VARIABLE
Context: http, server, location

Generates a version-4 UUID and assigns it to the specified variable.


Specify --add-module=/path/to/nginx-uuid4-module when you run ./configure.


./configure --add-module=/path/to/nginx-uuid4-module
make install

If you want to add this module as a dynamic module, specify --add-dynamic-module=/path/to/nginx-uuid4-module instead.


  • nginx-uuid4-module is licensed under the BSD 2-Clause License.
  • Mersenne twister (mt19937) is licensed under the BSD 3-Clause License.
You can’t perform that action at this time.