ancient_browser

The 'ancient_browser' directive controls the handling of requests from obsolete web browsers, allowing them to be redirected or served differently.

Syntaxancient_browser user-agent;
Defaultnone
Contexthttp, server, location
Arguments1+

Description

The 'ancient_browser' directive in NGINX is designed to manage incoming requests from browsers that are deemed outdated or incompatible with modern web standards. By specifying the 'ancient_browser' directive, server administrators can determine whether to serve special content, redirect the user to a different URL, or apply specific policies for these legacy browsers. This is particularly useful when dealing with security concerns or ensuring that users with outdated browsers are aware of the limitations of their technology.

This directive can take multiple arguments, each representing a specific browser or user agent string that is identified as an ancient browser. The behavior can include custom error pages, redirection to upgrade prompts, or serving a simplified version of the site specifically designed for these outdated clients. The flexibility in defining which browsers fall into this category enables fine-grained control over how an NGINX server interacts with legacy clients, ensuring a good balance between accessibility and modern web performance.

When configuring this directive, important considerations include ensuring that the correct user-agent patterns are specified, as well as understanding that different contexts (http, server, and location) can influence the directive's effectiveness. It’s also important to keep in mind the need to balance between supporting older technologies and preserving security and performance standards on the server.

Config Example

http {
    ancient_browser "MSIE 5.0";
    ancient_browser "Mozilla/4.0";
    location / {
        # Normal processing
    }
}

Browser detection is based on user-agent strings which can be spoofed.

Carefully craft user-agent strings to ensure correct matching without unintended blocks.

Test the behavior thoroughly to ensure users are not unduly hindered due to outdated browsers.

← Back to all directives