HTTP directives

server_name_in_redirect directive (HTTP)

Use the configured primary server name for Nginx-generated absolute redirects. Test public hostname and port; not an arbitrary upstream Location rewrite. Context: http, server, location. Documented default: off. Version: Introduction not established. OSS documentation; check target build. Example is a partial http configuration fragment; use a disposable lab, not a production tuning prescription.

Formal Syntax & Structure

nginx syntaxnginx
server_name_in_redirect on | off;

Parameters & Attributes

NameTypeDescription
stateon | offSelect whether this behavior is enabled.

Working Example

Example Snippetnginx
server_name_in_redirect on;
Nginx Reference