upstream_show
The `upstream_show` directive displays the current upstream configuration for the specified upstream block.
Description
The upstream_show directive is used within the context of a location block in NGINX configurations, particularly when using the NGINX module for syncing upstreams from Consul or etcd. When this directive is activated, it outputs the configuration details of the upstream servers that have been defined and synchronized from the specified configuration service (like Consul or etcd). This is particularly useful for debugging and verifying the current state of upstreams without needing to reload the configuration or restart the NGINX server. The display can include server weights, health status, and connection states, providing insights into the load-balancing configuration and any potential issues with backend services.
The behavior of the upstream_show directive relies on its ability to read and report the existing upstream server configurations defined by previous directives, primarily those configured with the upsync directive. By appending this in a location, administrators can have an endpoint in their application that, when accessed, returns the current state of the upstream servers, helping in diagnosing service-related issues quickly without any service disruption. Since it does not require any parameters or additional arguments, it simplifies usage within the configuration file.
Config Example
location = /upstream_show {
upstream_show;
}Ensure the upstream_show directive is specified only within a valid location context; otherwise, it will lead to configuration errors.
Do not expect upstream_show to modify any upstream configurations, as it is purely for displaying the current state.