Available in all subroutines.

Derives a UUID corresponding to name within the given namespace using a random number generator. The namespace itself is identified by a UUID. The name must be in a canonical form appropriate for the selected namespace.

IMPORTANT: In principle, names can be arbitrary octet strings. This implementation will, however, truncate at the first NUL byte.


set req.http.X-Unique-Id = uuid.version4();

Try it out

uuid.version4 is used in the following solution recipes, which show real world use cases. Click RUN to provision a Fastly service, execute the code on Fastly, and see how the function behaves.

A/B testing

Serve different responses to separate user cohorts.

User contributed notes

We welcome comments that add use cases, ideas, tips, and caveats. All comments will be moderated before publication. To post support questions, visit our support center and we'll find you the help you need.