Support

Admin Tools

#26020 Json error after password protecting admin folder

Posted in ‘Admin Tools for Joomla! 4 & 5’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Environment Information

Joomla! version
n/a
PHP version
n/a
Admin Tools version
n/a

Latest post by on Sunday, 02 October 2016 17:20 CDT

user66511
Enabling Password-protect Administrator immediately generates error message: 404 Catalog not found.

Message in error_log: [01-Sep-2016 17:34:36 America/Chicago] PHP Strict Standards: Declaration of Akeeba\AdminTools\Admin\View\SecurityExceptions\Json::onBeforeBrowse() should be compatible with FOF30\View\DataView\Json::onBeforeBrowse($tpl = NULL) in /home/DOMAIN-NAME/public_html/administrator/components/com_admintools/View/SecurityExceptions/Json.php on line 16

nicholas
Akeeba Staff
Manager
Ask your host to disable Apache custom error pages for HTTP status codes 401 and 403. The PHP strict notice is actually irrelevant to your issue.

Why does this happen? When you enable password protection all you're doing is create a .htaccess which tells Apache that the administrator directory is password protected. The next time your browser tries to access a resource in that directory it has to present a valid HTTP Basic Authentication header. If it doesn't, Apache returns an HTTP 401 status which, in turn, instructs the browser to ask you for the username and password (and then store it in its authentication cache for the browsing session).

However, HTTP 401 is an HTTP error status. Apache has a feature called custom error pages. Depending on the HTTP error status returned (4xx and 5xx) you can configure it to return a page with custom HTML content instead of the standard stark error message. This holds true even for the 401 status whose error page is normally NOT shown to the user. The problem is that the configure custom error page does not exist. This causes Apache to change the HTTP status to a 404 Not Found error. This breaks the authentication flow.

If that wasn't bad enough, Joomla is always configured to catch all 404 errors and try to figure out if it should try and serve a page instead. This is required for the correct operation of search engine friendly URLs. Now Joomla sees the 404 error with a URL it cannot understand so it tries to route it through com_content (the articles component). Hard as it may try, it can't find an article category which matches the URL, therefore throws the error you are receiving.

I know that's a crazy sequence of events but you'd surprised at how common it is. In fact, I think I might document it for the next version of Admin Tools.

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

System Task
system
This ticket has been automatically closed. All tickets which have been inactive for a long time are automatically closed. If you believe that this ticket was closed in error, please contact us.

Support Information

Working hours: We are open Monday to Friday, 9am to 7pm Cyprus timezone (EET / EEST). Support is provided by the same developers writing the software, all of which live in Europe. You can still file tickets outside of our working hours, but we cannot respond to them until we're back at the office.

Support policy: We would like to kindly inform you that when using our support you have already agreed to the Support Policy which is part of our Terms of Service. Thank you for your understanding and for helping us help you!