nchan_subscriber_message_id_custom_etag_header

Defines a custom ETag header for subscriber messages in NGINX's Nchan module.

Syntaxnchan_subscriber_message_id_custom_etag_header header_name;
Defaultnone
Contextserver, location, if in location
Arguments1

Description

The nchan_subscriber_message_id_custom_etag_header directive allows you to set a custom HTTP header that will be used for the ETag of messages sent to subscribers. This is particularly useful for managing cache validation and ensuring that clients can check for updates to messages without having to rely solely on the default ETag behavior. By configuring this directive, subscribers can receive messages that include an ETag header tailored to their requirements, enhancing the overall control over message caching and delivery processes.

When it is used in a configuration, the argument provided becomes the name of the custom ETag header. This header can then be utilized by subscribers to efficiently manage and validate their message cache against the server's published messages. The directive must be declared within the context of a server block, location block, or within an if statement inside a location block, thus allowing granular control depending on the routing of requests.

It's important to note that setting this directive does not automatically affect the format of the ETag; rather, it merely specifies which header to use for the ETag value during transmission to subscribers. Therefore, users must ensure that the server-side implementation correctly constructs the ETag values associated with specific messages or channels to fully leverage this functionality.

Config Example

location /subscribe {
    nchan_subscriber_message_id_custom_etag_header X-My-Custom-ETag;
    nchan_subscriber_channel_id my_channel;
}

Ensure the header name provided is valid and does not conflict with existing headers.

Remember to implement logic server-side to generate appropriate ETag values for messages.

This directive only sets the header name; the actual ETag value must be managed separately.

← Back to all directives