uwsgi_ssl_server_name

The `uwsgi_ssl_server_name` directive specifies whether to send the server name to a uWSGI server over SSL.

Syntaxuwsgi_ssl_server_name on | off;
Defaultoff
Contexthttp, server, location
Argumentsflag

Description

The uwsgi_ssl_server_name directive is applicable in different contexts including http, server, and location. When enabled, it instructs NGINX to pass the server name specified in the Host header to the uWSGI application when communicating over SSL. This is particularly useful in cases where the uWSGI server needs to be aware of the original server name due to virtual hosting configurations.

When set to 'on', NGINX will include the SERVER_NAME variable in the uWSGI requests, enabling more accurate routing and behavior based on the virtual host configuration. The parameter requires only a flag with no additional arguments; simply setting the directive enables its functionality. It is important to ensure that the target uWSGI application can correctly interpret the passed server name without misrouting requests or causing errors in handling HTTP responses.

This directive enhances the compatibility and integration between NGINX and uWSGI in cases of SSL termination, making it a useful option for developers looking to maintain context for their web applications while using secure connections. Adjusting this setting may be necessary if you experience issues with how requests are handled based on the server name in scenarios involving multiple domain applications on the same backend environment.

Config Example

server {
    listen 443 ssl;
    server_name example.com;
    # other ssl configurations

    location / {
        uwsgi_pass unix:/path/to/your.sock;
        uwsgi_ssl_server_name on;
        uwsgi_param SCRIPT_NAME '';
        uwsgi_param PATH_INFO $uri;
    }
}

Ensure that your uWSGI application is configured to recognize the SERVER_NAME variable correctly.

This directive only applies when using SSL; ensure that your server block is configured for SSL connections.

Be cautious when using this directive with multiple server blocks as it may lead to unexpected behaviors if not handled properly.

← Back to all directives