How do I resolve the error "SSL received a record that exceeded the maximum permissible length" in apache2?

admin

It's possible to lớn get this error if your virtual host configuration is incomplete and relies on ssl.conf (vendor installed) to lớn tự the setup for you. For example if you have a something lượt thích this (RHEL7/httpd 2.4):

/etc/httpd/conf.d/confluence.conf


    ServerName  localhost.localdomain
    DocumentRoot /var/www/html

/var/www/html/index.html

helo

Then because confluence.conf is alphabetically before ssl.conf, the SSL virtual host will not yet have been evaluated and httpd will use port 443 to lớn serve unencrypted data, which you can prove lượt thích this:

[root@localhost ~]# curl https://localhost.localdomain 
curl: (35) SSL received a record that exceeded the maximum permissible length.
[root@localhost ~]# curl http://localhost.localdomain:443   
helo

In this case we can see the second curl works because the connection on port 443 is speaking plain http.

If we rename confluence.conf to lớn be alphabetically after ssl.conf, then the SSL port will have been setup and it all starts working, eg:

[root@localhost vagrant]# curl https://localhost.localdomain -k
curl: (35) SSL received a record that exceeded the maximum permissible length.
[root@localhost vagrant]# mv /etc/httpd/conf.d/confluence.conf /etc/httpd/conf.d/t.conf         
[root@localhost vagrant]# systemctl restart httpd
[root@localhost vagrant]# curl https://localhost.localdomain -k
helo

My recommendation to lớn fix this would be to lớn configure mod_ssl within the VirtualHost directive:


    ...
    SSLEngine on
    SSLCertificateFile /etc/pki/tls/certs/localhost.crt
    SSLCertificateKeyFile /etc/pki/tls/private/localhost.key

Alternatively, renaming the tệp tin containing the VirtualHost definition to lớn come alphabetically after ssl.conf will will work but this technique can be easily overlooked.