$google_host

The variable $google_host contains the host portion of the Google URL being mirrored by the NGINX module. — NGINX Module for Google Mirror creation

$google_host NGINX Module for Google Mirror creation

Description

The `$google_host` variable is part of the NGINX Module for Google, specifically designed for creating mirrors of Google services. This variable is dynamically set during a request when the Google mirror functionality is enabled. Essentially, it extracts the host part of the incoming request URL directed at Google, thus allowing servers to manipulate or log the host as needed. It is typically utilized in locations where response manipulations or logging based on the Google host are necessary. When the Google filter is activated, the module hooks into the request lifecycle, capturing the request details including the host information. If the request is made to a valid Google service, this variable will reflect that service's host name (like `www.google.com`, `news.google.com`, etc.). The variable is marked as changeable, meaning it can be adjusted or updated during request processing, allowing for real-time adjustments based on application logic or conditions within different request contexts.

Config Example

location / {
    google on;
    add_header X-Google-Host $google_host;
}

Subsystem

http

Cacheable

No

Contexts

http, server, location, if

Ensure the Google filter is enabled for the $google_host variable to be populated; otherwise, it will not return a valid value.

Using $google_host outside of appropriate contexts (like server or location) may lead to undefined behavior or incorrect values.