@@ -370,19 +370,6 @@ int ssl_hook_ReadReq(request_rec *r)
370370 " provided in HTTP request" , servername );
371371 return HTTP_BAD_REQUEST ;
372372 }
373- if (r -> server != handshakeserver
374- && !ssl_server_compatible (sslconn -> server , r -> server )) {
375- /*
376- * The request does not select the virtual host that was
377- * selected by the SNI and its SSL parameters are different
378- */
379-
380- ap_log_rerror (APLOG_MARK , APLOG_ERR , 0 , r , APLOGNO (02032 )
381- "Hostname %s provided via SNI and hostname %s provided"
382- " via HTTP have no compatible SSL setup" ,
383- servername , r -> hostname );
384- return HTTP_MISDIRECTED_REQUEST ;
385- }
386373 }
387374 else if (((sc -> strict_sni_vhost_check == SSL_ENABLED_TRUE )
388375 || hssc -> strict_sni_vhost_check == SSL_ENABLED_TRUE )
@@ -403,6 +390,21 @@ int ssl_hook_ReadReq(request_rec *r)
403390 "which is required to access this server.<br />\n" );
404391 return HTTP_FORBIDDEN ;
405392 }
393+ if (r -> server != handshakeserver
394+ && !ssl_server_compatible (sslconn -> server , r -> server )) {
395+ /*
396+ * The request does not select the virtual host that was
397+ * selected for handshaking and its SSL parameters are different
398+ */
399+
400+ ap_log_rerror (APLOG_MARK , APLOG_ERR , 0 , r , APLOGNO (02032 )
401+ "Hostname %s %s and hostname %s provided"
402+ " via HTTP have no compatible SSL setup" ,
403+ servername ? servername : handshakeserver -> server_hostname ,
404+ servername ? "provided via SNI" : "(default host as no SNI was provided)" ,
405+ r -> hostname );
406+ return HTTP_MISDIRECTED_REQUEST ;
407+ }
406408 }
407409#endif
408410 modssl_set_app_data2 (ssl , r );
0 commit comments