Misdirected Request 421 error

Hi,

After the last update, a lot of my sites broke that had custom nginx templates. We started getting:

Misdirected Request

The client needs a new connection for this request as the requested host name does not match the Server Name Indication (SNI) in use for this connection.

After looking into it, it seems these were missing from my nginx templates:

proxy_ssl_server_name on;

proxy_ssl_name $host;

I added it in, rebuilt the accounts, and now it works. Hopefully if someone comes across this, it will help them :slight_smile: (not what I wanted to be doing at 4:30am, with baby brain haha)

Cheers

Andy

Hi,

Could you please let me know the locations and names of the custom templates that were modified?

Hi

They were just custom templates we had for a special setup. In the normal config folders. For example

#=========================================================================#
# Default Web Domain Template                                             #
# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS   #
# https://hestiacp.com/docs/server-administration/web-templates.html      #
#=========================================================================#

server {

    listen      %ip%:%proxy_ssl_port% ssl;
    listen      [::]:%proxy_ssl_port% ssl;
	server_name %domain_idn% %alias_idn%;
	error_log   /var/log/%web_system%/domains/%domain%.error.log error;

	ssl_certificate     %ssl_pem%;
	ssl_certificate_key %ssl_key%;
	ssl_stapling        on;
	ssl_stapling_verify on;


	# TLS 1.3 0-RTT anti-replay
	if ($anti_replay = 307) { return 307 https://$host$request_uri; }
	if ($anti_replay = 425) { return 425; }

	include %home%/%user%/conf/web/%domain%/nginx.hsts.conf*;
	
	location ~ /\.(?!well-known\/|file) {
		deny all;
		return 404;
	}

	location ~* ^/(wp-admin|wp-includes|wp-content|xmlrpc\.php|readme\.html|license\.txt|wp-config\.php) {
		return 403;
	}

	if ($bad_bot) {
		return 403;
	}

    if ($blocked_country) {
        return 403;
    }


	location / {

		include /etc/nginx/alibabamain-deny.conf;
		
		proxy_pass https://%ip%:%web_ssl_port%;

		expires 1d;

		location ~* ^.+\.(html|htm)$ { 
			try_files  $uri @fallback;
			
		}

		location ~* ^.+\.(%proxy_extensions%)$ {
			try_files  $uri @fallback;

			root       %sdocroot%;
			access_log /var/log/%web_system%/domains/%domain%.log combined;
			access_log /var/log/%web_system%/domains/%domain%.nginx.log main;
			access_log /var/log/%web_system%/domains/%domain%.bytes bytes;

			expires    max;
		}

		#limit_req zone=fbhit burst=5 nodelay;
	}

	location @fallback {
		access_log /var/log/apache2/domains/%domain%.log cloudflare;
		proxy_pass https://%ip%:%web_ssl_port%;
	}

	location /error/ {
		alias %home%/%user%/web/%domain%/document_errors/;
	}

	proxy_hide_header Upgrade;

	include %home%/%user%/conf/web/%domain%/nginx.ssl.conf_*;
}

and this was missing:


	proxy_ssl_server_name on;
	proxy_ssl_name $host;

I fixed them up, rebuilt the users, and now it works.

Cheers

Andy

But what’s the name of the custom template?. I’m asking because if you don’t change the template name and assign it to your sites, it will be replaced again in next update.

that one was called default-wbs.stpl. and the other was default2.stpl. I learned early on about not using the default.xx format as it got overwritten :slight_smile:

I don’t know what happened but Hestia doesn’t override or modify non-default templates.