Skip to main content

Fixing "421 Misdirected Request" for Plesk Sites on Ubuntu 22.04 After Apache Update

7 min read
Fix my Plesk 421 errors

We correct the SNI handling between nginx and Apache and make the fix survive future updates.

Resolve the 421 Misdirected Request error affecting all HTTPS sites on Plesk for Ubuntu 22.04 after an Apache update, caused by changed SNI requirements in the nginx-to-Apache proxy chain.

Fixing the 421 Misdirected Request Error on Plesk (Ubuntu 22.04)

After certain Apache security updates on Ubuntu 22.04, all HTTPS sites managed by Plesk may suddenly return a "421 Misdirected Request" error. This guide explains the root cause, provides a step-by-step fix, and shows how to automate the workaround so it survives future updates.

1. Symptoms

  • All HTTPS sites on Plesk for Ubuntu 22.04 begin returning 421 Misdirected Request.
  • Browsers display a message about the requested hostname not matching the Server Name Indication (SNI) in use.
  • HTTP sites continue to work normally; only HTTPS traffic is affected.

2. Root Cause

Recent CVE patches for Apache changed how it enforces SNI (Server Name Indication) matching on TLS connections. In Plesk's architecture, nginx sits in front of Apache as a reverse proxy. By default, nginx does not forward the SNI hostname when proxying HTTPS requests to Apache. After the Apache update, Apache now strictly requires that the SNI hostname matches the requested virtual host, and since nginx is not sending it, Apache rejects the connection with a 421 error.

3. Step-by-Step Resolution

3.1 SSH into the Server

ssh root@your-server-ip

3.2 Create the nginx Fix File

Add the following directives to forward the SNI header from nginx to Apache:

cat <<'EOF' > /etc/nginx/conf.d/99-proxy-sni.conf
proxy_ssl_server_name on;
proxy_ssl_name $host;
EOF

3.3 Reload nginx

service nginx restart

3.4 Verify Apache Connectivity

Watch Apache's error log:

tail -f /var/log/apache2/error.log

Then test with curl:

curl -Ik https://www.your-domain.com/

We should see a 200 OK response instead of the 421 error.

4. Why the Fix Works

  • proxy_ssl_server_name on; tells nginx to include the SNI extension in the SSL handshake with Apache.
  • proxy_ssl_name $host; ensures the handshake uses the requested hostname.

With SNI enabled, Apache selects the correct SSL virtual host and certificate, eliminating the 421 error.

5. Automating the Workaround

To ensure the fix survives package updates and nginx restarts, we can create a simple script and schedule it via cron:

cat <<'EOF' > /usr/local/sbin/plesk-nginx-sni-fix.sh
#!/bin/bash
echo -e "proxy_ssl_server_name on;\nproxy_ssl_name \$host;" > /etc/nginx/conf.d/99-proxy-sni.conf
service nginx reload
EOF
chmod +x /usr/local/sbin/plesk-nginx-sni-fix.sh
ln -s /usr/local/sbin/plesk-nginx-sni-fix.sh /etc/cron.daily/plesk-nginx-sni-fix

This runs daily to re-apply the configuration if it gets overwritten.

6. Best Practices & Tips

  • Disable auto-OS updates during peak hours in Plesk to avoid surprises.
  • Monitor logs with journalctl -f and tail -f /var/log/nginx/error.log.
  • Staging first: clone and test before applying updates to production.
  • Snapshots: back up the VM or instance before critical package changes.
  • Stay informed: follow the Plesk knowledge base for official patches.
  • Use Ansible or Puppet for fleet-wide rollout and verification of the SNI fix.

Frequently asked questions

Why do Plesk sites on Ubuntu 22.04 return 421 Misdirected Request after an Apache update?

Recent CVE patches for Apache changed how it enforces SNI matching on TLS connections. In Plesk, nginx sits in front of Apache as a reverse proxy and by default does not forward the SNI hostname when proxying HTTPS requests. Apache now strictly requires the SNI hostname to match the requested virtual host, so it rejects those connections with a 421 error.

How do I fix 421 Misdirected Request on Plesk?

Make nginx forward the SNI hostname to Apache. Create /etc/nginx/conf.d/99-proxy-sni.conf with the two directives proxy_ssl_server_name on and proxy_ssl_name $host, then restart nginx with service nginx restart. A curl -Ik request to one of the HTTPS sites should then return 200 OK in place of the 421 error.

What do proxy_ssl_server_name and proxy_ssl_name do in nginx?

The proxy_ssl_server_name on directive tells nginx to include the SNI extension in its SSL handshake with Apache. The proxy_ssl_name $host directive makes that handshake use the hostname the visitor requested. With SNI in place, Apache selects the correct SSL virtual host and certificate, and the 421 error goes away.

Does the Plesk 421 Misdirected Request error affect HTTP sites?

No, only HTTPS traffic is affected, and HTTP sites keep working normally. On HTTPS, every Plesk site on Ubuntu 22.04 starts returning 421 Misdirected Request, and browsers show a message saying the requested hostname does not match the Server Name Indication (SNI) in use.

How can I confirm the Plesk 421 fix worked?

Watch Apache's error log with tail -f /var/log/apache2/error.log, then request one of the HTTPS sites with curl -Ik against its domain. A 200 OK response in place of 421 confirms that nginx now passes SNI to Apache.

How do I keep the Plesk nginx SNI fix after package updates?

Put the fix in a script at /usr/local/sbin/plesk-nginx-sni-fix.sh that rewrites /etc/nginx/conf.d/99-proxy-sni.conf with the two proxy_ssl directives and reloads nginx. Make the script executable with chmod +x and symlink it as /etc/cron.daily/plesk-nginx-sni-fix. Cron then re-applies the configuration every day in case an update overwrites it.

How do I reduce the risk of Apache updates breaking Plesk sites?

Disable automatic OS updates during peak hours in Plesk so updates do not land at a bad moment. Test updates on a staging clone before production, snapshot the VM or instance before critical package changes, and follow the Plesk knowledge base for official patches. Across a fleet, Ansible or Puppet can roll out and verify the SNI fix on every server.

Which logs help troubleshoot a 421 error on Plesk?

Follow the system journal with journalctl -f and the nginx error log with tail -f /var/log/nginx/error.log. Apache's side shows up in /var/log/apache2/error.log, the log to watch while applying and testing the SNI fix.

Read how we handle it in Cloud & Server Management.