session_start

The `session_start` directive initializes the session start time for secure tokens used in CDN authentication.

Syntaxsession_start time;
Defaultnone
Context
Arguments1

Description

The session_start directive is a crucial configuration option within the Secure Token module for NGINX, used primarily for generating time-sensitive secure tokens for CDN requests. This directive defines the start time for a session, which can be either an absolute time or a time relative to the current time. This is essential for establishing when a CDN token becomes valid, allowing users to specify a precise point in time when access to the associated content starts. This flexibility enables effective control of content access, ensuring that tokens are only valid during specified times, thus enhancing security.

In practical usage, this directive takes one argument that can either be a specific timestamp or a relative expression indicating how long from the current time the session should begin. If a relative time is specified, the module will interpret it while processing the request, allowing for dynamic expiration and access control benefits. The session start time is used in conjunction with other settings like the end time, forming a complete session window that determines when the secure token is valid. This capability is particularly useful for streaming media, where you need precise control over user access during a predefined window, ensuring customers receive access to content without security risks.

In the source code, the processing of the start time utilizes certain utilities to evaluate whether the time is set as an absolute or a relative value. If set as relative, it will adjust the time based on the current system time when the token is being generated according to the specifications provided by the admin. Ultimately, suitable configuration of this directive is key to leveraging the secure token functionalities optimally and effectively.

Config Example

session_start 10m;

Ensure the session start time is set correctly to avoid immediate expiration of access tokens.

Be aware of time zone differences if using absolute timestamps.

Using too short a session start can lead to access issues for users.

← Back to all directives