Support

Admin Tools

#26289 The most recent request was denied because it contained an invalid security token. Please refresh the page and try again.

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 Clarenceljw on Tuesday, 11 October 2016 22:22 CDT

Clarenceljw
  Hi Guys,

Both my Joomla websites clarenceling.com and walta.com.au are experiencing this error:

The most recent request was denied because it contained an invalid security token. Please refresh the page and try again.

I can log in, but only the first time. The only way to fix it is to modify the .htaccess file. It seems recreating the .htaccess file fixes the security token issue.

Please help me fix this bug. Thank you.

Clarenceljw
The login module I am having trouble with is SourceCoast's SCLogin module on the frontend of my websites.

Clarenceljw
"Redirect index.php to site's root" is turned off and "Enable Session Optimiser" is switched off.

Clarenceljw
Do not Track is also off, so that can't be it.

nicholas
Akeeba Staff
Manager
Assuming you are using the .htaccess Maker feature: please try setting the "Set default expiration time to 1 hour" option to No and then click on "Save & Create .htaccess".

The root cause of this issue seems to be the same as your ticket 26290. This .htaccess option tells the web server to set the default expiration time by document type, including text/html i.e. the pages created by Joomla. This shouldn't be a problem as Joomla sends cache busting headers where necessary. Unfortunately, Joomla 3.4 and later have a significant bug / oversight in redirections. Instead of using HTTP 307 for temporary redirections from one page to the next, Joomla is using HTTP 301. Unfortunately HTTP 301 is the HTTP code for a permanent redirection which is cached by all major browsers (Chrome, Firefox, Opera, Safari, Edge). This causes the browsers to not visit certain pages which are necessary for Joomla! to operate correctly, causing this inexplicable errors. It took me a debugging session several hours long to figure that out last week. The next version of Admin Tools will contain a fix for this issue (we will not set up a default expiration time for text/html documents).

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!

Clarenceljw
Hi Nicholas,

Unfortunately that does not seem to be it, the error is still there.

I am running Cache Cleaner by RegularLabs, and automatically clean my cache from both frontend and backend automatically.

Does this change your advice?

nicholas
Akeeba Staff
Manager
Yes. I believe it's a completely different issue with your server. There's only one way to troubleshoot it.

Start by disabling all options in the .htaccess Maker. This creates a .htaccess file which is functionally identical to the .htaccess shipped with Joomla. Test if the problem happens. If it does, it's unrelated to our software.

Then start enabling a few options at a time and create a new .htaccess. Test if the problem happens. If it does, it's one of the options you just enabled. Try switching them off one by one, generate the .htaccess and test again. This way you can find out which option causes this issue on your server.

FWIW I would expect that your problem would be more likely to happen because of Admin Tools' system plugin's session cleaning or a third party session cleaner, not the .htaccess. The security token is stored in the session. The session is remembered across page loads with a cookie. There's nothing in the .htaccess to remove the cookie and the session itself is controlled only by PHP code.

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!

Clarenceljw
Hi Nicholas,

Here is something interesting. Disabling the Admin Tools session cleaner fixed one problem, getting into an extension a second time. But the problem with the Login remains, but can now be fixed with the cache cleaner purging the cache.

I don't think its the .htaccess issue, I've run one test (correctly hopefully) and the problem remained.

Who do you recommend I ask help from? RegularLabs? (The makers of Cache Cleaner)

nicholas
Akeeba Staff
Manager
Just to make sure: you have disabled the "Set default expiration to 1 hour" but the login issue remains UNLESS you enable Cache Cleaner. If this is the case the problem you have is with your login module when you have Joomla's caching enabled. Even though that's outside of scope of our support I can give you a quick hint.

I would recommend disabling caching from Joomla's Global Configuration. If that works edit the login module's options and set Caching to None (instead of Use Global Option or something along those lines that it currently reads). Then re-enable Joomla's cache. This should work. If not either contact the module's developer or disable caching.

For what it's worth, we have chosen to disable caching on our site. As soon as we switched to PHP 7.0 our benchmarks showed a 20% performance drop(!!!) with file caching enabled. Turning off the cache made the site faster – and we had far less outdated cache issues to deal with. PHP 7 is blazing fast! Using caching on Joomla only makes sense on very large sites and only if you're using a memory cache, distributed on multiple servers (e.g. memcache, Redis). For the vast majority of sites you're better off just using PHP 7 and possibly enabling Zend Opcache, the code cache that ships with PHP itself – just remember to purge the code cache every time you update Joomla or one of its extensions.

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!

Clarenceljw
Hi Nicholas,

Problem solved, it was the System - Page Cache plugin.

Thank you for your suggestion of using PHP7, I'll implement it ASAP.

Cheers.

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!