cart icon 0

Resolution of the "421 Misdirected Request" Error After an Apache Update Print

  • #Plesk #Apache #Erreur421 #MisdirectedRequest #WebHosting #
  • 0

Resolution of the "421 Misdirected Request" Error After an Apache Update

Some websites hosted on Plesk servers may encounter the following error after a recent Apache update:

Error: 421 Misdirected Request

This error will manifest with a message similar to this in your domain logs:

AH02032: Hostname default-203_0_113_2 (default host as no SNI was provided) and hostname www.example.com provided via HTTP have no compatible SSL setup

Cause of the Issue

Recent Apache updates have changed how Apache and Nginx interact, particularly in terms of handling HTTPS connections. By default, Nginx does not pass the server name via SNI when establishing a connection with Apache. This prevents Apache from finding the correct SSL certificate, which results in the "421 Misdirected Request" error.

Solution

The solution is to add directives in the Nginx configuration so that Nginx sends the server name to Apache via the TLS Server Name Indication (SNI) extension.

Resolution Steps:

  1. Connect to the server via SSH: Use a terminal or an SSH client to access your server.
  2. Run the fix script: Run the following script on your server, without modifications:
echo -e "proxy_ssl_server_name on;\nproxy_ssl_name \$host;\nproxy_ssl_session_reuse off;" > /etc/nginx/conf.d/fixssl.conf && systemctl restart nginx

This script adds three directives to the Nginx configuration:

  • proxy_ssl_server_name on; : Enables server name passing via SNI.
  • proxy_ssl_name \$host; : Passes the server name to Apache via the $host variable.
  • proxy_ssl_session_reuse off; : Disables SSL session reuse.

Restart Nginx:

The script automatically restarts Nginx, but if you made manual changes, you will need to run the following command to apply the changes:

systemctl restart nginx

Verification:

After applying these changes, your websites should be accessible again without the "421 Misdirected Request" error. It is recommended to check the logs to ensure the error is resolved.

Additional Information:

This issue affects Plesk installations with Apache and Nginx configured as a reverse proxy. A future Plesk update (versions 18.0.70 and 18.0.71) may include an official fix for this problem. We recommend keeping an eye on Plesk updates and checking the knowledge base regularly.

Need Help?

If you have any questions or need further assistance, feel free to contact us. Our team is here to help.


Was this answer helpful?
Back