Custom 404 Page not working with SSL Topic is solved

This forum is for general questions about extensions for Joomla! 3.x.

Moderators: pe7er, General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
Locked
mattyarranton
Joomla! Apprentice
Joomla! Apprentice
Posts: 7
Joined: Tue Oct 20, 2015 6:44 pm

Custom 404 Page not working with SSL

Post by mattyarranton » Thu Nov 15, 2018 11:52 am

Hi,

I am using the Shape5 Bigbusiness template which provides a custom 404 error page. The problem I have is that I only get a standard browser 404 when the site is accessed over SSL, it works fine for HTTP. I have asked on the Shape5 forums but they have suggested this is more of a fundamental Joomla thing. Everything else works fine over SSL, and I have tried going back to the default .htaccess file and still have the same issue.

The only difference I can see in the access logs is that the referrer and page size are blank when using SSL. There is nothing in the error_log or php_error_log when these are accessed.

SSL
https://www.waterauditsurveys.com/blah
x.x.x.x - - [15/Nov/2018:12:42:48 +0100] "GET /blah HTTP/1.1" 404 - "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36"

non-SSL
http://www.waterauditsurveys.com/blah
x.x.x.x - - [15/Nov/2018:12:44:44 +0100] "POST /blah HTTP/1.1" 404 40468 "http://www.waterauditsurveys.com/blah" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36"

I am using a couple of other extensions that may be having an impact, any ideas?

Joomla! 3.9.0
Akeeba Admin Tools 5.1.4
JSitemap Pro 4.5.2

Matt...

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 44071
Joined: Sat Apr 05, 2008 9:58 pm

Re: Custom 404 Page not working with SSL

Post by Webdongle » Thu Nov 22, 2018 9:03 am

Something in your .htaccess? Of lacking in your .htaccess?
The coding in their 404.php?
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".

mattyarranton
Joomla! Apprentice
Joomla! Apprentice
Posts: 7
Joined: Tue Oct 20, 2015 6:44 pm

Re: Custom 404 Page not working with SSL

Post by mattyarranton » Fri Nov 23, 2018 3:21 pm

I have fixed this and thought you'd be interested for reference. Basically it was an SSL validation issue as the server was reporting that it could not validated the certificate chain of the site. What seemed to be happening is during the process the server was making an SSL connection back to itself somehow (I assume rather than telling the browser to) and then the internal server was failing to validate the certificate path. This error was present in the php_error_log:
[22-Nov-2018 06:02:09 Europe/Berlin] PHP Warning: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /opt/lampp/htdocs/WAS-2018/templates/bigbusiness/error.php on line 23
[22-Nov-2018 06:02:09 Europe/Berlin] PHP Warning: file_get_contents(): Failed to enable crypto in /opt/lampp/htdocs/WAS-2018/templates/bigbusiness/error.php on line 23
[22-Nov-2018 06:02:09 Europe/Berlin] PHP Warning: file_get_contents(https://mywebsite/index.php?option=com_ ... &amp;id=67): failed to open stream: operation failed in /opt/lampp/htdocs/WAS-2018/templates/bigbusiness/error.php on line 23
This seems to stem from how linux builds its certificate chain when the issuing CA certificate is not present, and also explains why I didn't have any other SSL problems when browsing the site as browsers do this differently.

A simple way to check this was to run from the servers CLI

Code: Select all

curl https://mywebsite
and I got the following error:
curl: (60) SSL certificate problem: unable to get local issuer certificate
Anyhow, the fix was quite simple in the end, I just need to declare the issuing CA certificate file in the Apache host config using the SSLCACertificateFile option, restarted Apache and it worked!

Hope this helps someone else in the future!


Locked

Return to “Extensions for Joomla! 3.x”