Unecessary call to /component/ajax/?format=json on every page

Discussion regarding Joomla! 3.x Performance issues.

Moderator: 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.
Post Reply
Cococoder
Joomla! Apprentice
Joomla! Apprentice
Posts: 9
Joined: Wed Oct 02, 2019 9:48 am

Unecessary call to /component/ajax/?format=json on every page

Post by Cococoder » Wed Oct 02, 2019 12:46 pm

Hello ,

Joomla 3.9.12.
VirtueMart 3.6.2 10159
PHP Version 7.2.22

Browsing my access logs I noticed that component/ajax/?format=json call where systematically followed by a /component/ajax?format=json

Looking in the source code I found this line
system.keepalive":{"interval":300000,"uri":"\/component\/ajax\/?format=json"}

in <script type="application/json" class="joomla-script-options new">

I guess it should be written: system.keepalive":{"interval":300000,"uri":"\/component\/ajax?format=json"} to avoid the redirect.

I made a search for the string but only the cached page came out. Can someone assists? Also I think it should be fixed on joomla core file, can anyone confirm?

SharkyKZ
Joomla! Ace
Joomla! Ace
Posts: 1642
Joined: Fri Jul 05, 2013 10:35 am
Location: Parts Unknown

Re: Unecessary call to /component/ajax/?format=json on every page

Post by SharkyKZ » Wed Oct 02, 2019 5:52 pm

I have the same link but it does not perform a redirect. Do you have any other extensions installed? Any SEO extensions?

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

Re: Unecessary call to /component/ajax/?format=json on every page

Post by Webdongle » Wed Oct 02, 2019 6:10 pm

http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"The definition of insanity is doing the same thing over and over again, but expecting different results": Albert Einstein

mbabker
Joomla! Hero
Joomla! Hero
Posts: 2231
Joined: Sun Feb 28, 2010 8:26 pm

Re: Unecessary call to /component/ajax/?format=json on every page

Post by mbabker » Wed Oct 02, 2019 8:14 pm

This doesn't need an FPA.

It sounds like you have some kind of extension or some kind of web server configuration directive that strips trailing slashes and that is the redirect you are seeing. Identify the extension or contact your hosting provider to see if such a server-side rule exists and can be adjusted.

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

Re: Unecessary call to /component/ajax/?format=json on every page

Post by Webdongle » Wed Oct 02, 2019 9:09 pm

mbabker wrote:
Wed Oct 02, 2019 8:14 pm
...
It sounds like you have some kind of extension or some kind of web server configuration directive that strips trailing slashes...
Yes and the fpa lists extensions etc.
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"The definition of insanity is doing the same thing over and over again, but expecting different results": Albert Einstein

mbabker
Joomla! Hero
Joomla! Hero
Posts: 2231
Joined: Sun Feb 28, 2010 8:26 pm

Re: Unecessary call to /component/ajax/?format=json on every page

Post by mbabker » Wed Oct 02, 2019 9:41 pm

Well aware. I'm also aware of how often an FPA is posted and people spend time nit-picking over details in it unrelated to the OP's issue and completely ignoring the last PHP error (the first thing displayed) when it actually does relate to the issue. Yeah, it's a good tool for helping with deeper diagnostics, but unless it's spitting out component configurations or .htaccess file contents, this is an occasion where asking for it is overkill. Now, if the OP here wants to come back and say they have no idea what's on their site to deal with URL rewriting related issues, then sure, the FPA will help identify that.

Cococoder
Joomla! Apprentice
Joomla! Apprentice
Posts: 9
Joined: Wed Oct 02, 2019 9:48 am

Re: Unecessary call to /component/ajax/?format=json on every page

Post by Cococoder » Thu Oct 03, 2019 8:43 am

Hi guys, thanks for the replies.

Actually I have htaccess directive that strip trailing slash for none existing directories.

#Remove trailing slash for none existing directory
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} /(.*)/$
RewriteRule ^ /%1 [R=301,L]

That might be the reason why I have this redirect.
Those said, I would still like to address this. Regarding plugins I am running jotcache.

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

Re: Unecessary call to /component/ajax/?format=json on every page

Post by Webdongle » Thu Oct 03, 2019 9:09 am

mbabker wrote:
Wed Oct 02, 2019 9:41 pm
... I'm also aware of how often an FPA is posted and people spend time nit-picking ...
Yes pot the kettle heard you :D
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"The definition of insanity is doing the same thing over and over again, but expecting different results": Albert Einstein

Cococoder
Joomla! Apprentice
Joomla! Apprentice
Posts: 9
Joined: Wed Oct 02, 2019 9:48 am

Re: Unecessary call to /component/ajax/?format=json on every page

Post by Cococoder » Thu Oct 03, 2019 10:20 am

Forum Post Assistant (v1.4.9 (lambrusca) : 3rd October 2019 wrote:
Problem Description :: wrote:Unecessary trailing slash hardcoded in /component/ajax/?format=json
Log/Error Message :: wrote:redirect without the trailing slash
Actions Taken To Resolve wrote:search for the origin of the script
Basic Environment :: wrote:Joomla! Instance :: Joomla! 3.9.12-Stable (Amani) 24-September-2019
Joomla! Platform :: Joomla Platform 13.1.0-Stable (Curiosity) 24-Apr-2013
Joomla! Configured :: Yes | Read-Only (444) | Owner: --protected-- . (uid: 1/gid: 1) | Group: --protected-- (gid: 1) | Valid For: 3.9
Configuration Options :: Offline: false | SEF: true | SEF Suffix: false | SEF ReWrite: true | .htaccess/web.config: Yes | GZip: true | Cache: true | CacheTime: 15 | CacheHandler: file | CachePlatformPrefix: false | FTP Layer: false | Proxy: false | LiveSite: | Session lifetime: 15 | Session handler: none | Shared sessions: false | SSL: 2 | Error Reporting: default | Site Debug: false | Language Debug: false | Default Access: 1 | Unicode Slugs: true | dbConnection Type: mysqli | PHP Supports J! 3.9.12: Yes | Database Supports J! 3.9.12: Unknown | Database Credentials Present: Yes |

Host Configuration :: OS: Linux | OS Version: 4.4.186-1 | Technology: x86_64 | Web Server: Apache / ZoneOS | Encoding: gzip, deflate, br | Doc Root: --protected-- | System TMP Writable: Yes | Free Disk Space : 1425.54 GiB |

PHP Configuration :: Version: 7.2.22 | PHP API: cgi-fcgi | Session Path Writable: Yes | Display Errors: 1 | Error Reporting: 22519 | Log Errors To: /var/log.php.d/sisustusmoobel.ee.php.log | Last Known Error: 03rd October 2019 00:01:24. | Register Globals: | Magic Quotes: | Safe Mode: | Allow url fopen: 1 | Open Base: | Uploads: 1 | Max. Upload Size: 2047M | Max. POST Size: 2047M | Max. Input Time: -1 | Max. Execution Time: 30 | Memory Limit: 1024M

Database Configuration :: Connection Error: : Database Credentials Present? in Configuration...
Detailed Environment :: wrote:PHP Extensions :: Core (7.2.22) | date (7.2.22) | libxml (7.2.22) | openssl (7.2.22) | pcre (7.2.22) | sqlite3 (7.2.22) | zlib (7.2.22) | ctype (7.2.22) | curl (7.2.22) | dom (20031129) | hash (1.0) | fileinfo (1.0.5) | filter (7.2.22) | SPL (7.2.22) | iconv (7.2.22) | json (1.6.0) | mbstring (7.2.22) | session (7.2.22) | standard (7.2.22) | mysqlnd (mysqlnd 5.0.12-dev - 20150407 - $Id: 3591daad22de08524295e1bd073aceeff11e6579 $) | PDO (7.2.22) | pdo_mysql (7.2.22) | pdo_sqlite (7.2.22) | posix (7.2.22) | Reflection (7.2.22) | mysqli (7.2.22) | SimpleXML (7.2.22) | sockets (7.2.22) | exif (7.2.22) | tokenizer (7.2.22) | xml (7.2.22) | xmlreader (7.2.22) | xmlwriter (7.2.22) | cgi-fcgi () | bcmath (7.2.22) | ftp (7.2.22) | gettext (7.2.22) | imap (7.2.22) | xmlrpc (7.2.22) | calendar (7.2.22) | soap (7.2.22) | tidy (7.2.22) | xsl (7.2.22) | zip (1.15.4) | Phar (2.0.2) | intl (1.1.0) | gd (7.2.22) | redis (3.0.0) | imagick (3.4.3) | blackfire (1.26.1~linux-x64-non_zts72) | sodium (7.2.22) | Zend OPcache (7.2.22) | Zend Engine (3.2.0) |
Potential Missing Extensions ::
Disabled Functions :: system | shell_exec | passthru | exec | popen | proc_open |

Switch User Environment (Experimental) :: PHP CGI: Yes | Server SU: No | PHP SU: Yes | Custom SU (LiteSpeed/Cloud/Grid): Yes
Potential Ownership Issues: No
Folder Permissions :: wrote:Core Folders :: images/ (755) | components/ (755) | modules/ (755) | plugins/ (755) | language/ (755) | templates/ (755) | cache/ (755) | logs/ (---) | tmp/ (755) | administrator/components/ (755) | administrator/modules/ (755) | administrator/language/ (755) | administrator/templates/ (755) | administrator/logs/ (755) |

Elevated Permissions (First 10) ::
Extensions Discovered :: wrote:Components :: SITE ::
Core :: com_mailto (3.0.0) ? | com_wrapper (3.0.0) ? |
3rd Party::

Components :: ADMIN ::
Core :: com_users (3.0.0) ? | com_contenthistory (3.2.0) ? | com_redirect (3.0.0) ? | com_fields (3.7.0) ? | com_templates (3.0.0) ? | com_media (3.0.0) ? | com_content (3.0.0) ? | com_privacy (3.9.0) ? | com_newsfeeds (3.0.0) ? | com_checkin (3.0.0) ? | com_login (3.0.0) ? | com_banners (3.0.0) ? | com_joomlaupdate (3.6.2) ? | com_languages (3.0.0) ? | com_menus (3.0.0) ? | com_ajax (3.2.0) ? | com_installer (3.0.0) ? | com_modules (3.0.0) ? | com_tags (3.1.0) ? | com_postinstall (3.2.0) ? | com_search (3.0.0) ? | com_actionlogs (3.9.0) ? | com_messages (3.0.0) ? | com_admin (3.0.0) ? | com_associations (3.7.0) ? | com_finder (3.0.0) ? | com_categories (3.0.0) ? | com_cache (3.0.0) ? | com_plugins (3.0.0) ? | com_config (3.0.0) ? | com_cpanel (3.0.0) ? |
3rd Party:: tcpdf (1.0.8) ? | JCH Optimize (5.4.3) ? | AcyMailing (5.10.4) ? | VirtueMart_allinone (-) ? | VIRTUEMART (-) ? | ECB Currency Converter (1.0) ? | JotCache (6.2.1) ? | RSFirewall! (2.12.1) ? |

Modules :: SITE ::
Core :: mod_tags_similar (3.1.0) ? | mod_login (3.0.0) ? | mod_search (3.0.0) ? | mod_users_latest (3.0.0) ? | mod_custom (3.0.0) ? | mod_articles_latest (3.0.0) ? | mod_syndicate (3.0.0) ? | mod_wrapper (3.0.0) ? | mod_footer (3.0.0) ? | mod_feed (3.0.0) ? | mod_banners (3.0.0) ? | mod_menu (3.0.0) ? | mod_articles_news (3.0.0) ? | mod_articles_categories (3.0.0) ? | mod_finder (3.0.0) ? | mod_stats (3.0.0) ? | mod_random_image (3.0.0) ? | mod_languages (3.5.0) ? | mod_articles_category (3.0.0) ? | mod_whosonline (3.0.0) ? | mod_articles_popular (3.0.0) ? | mod_articles_archive (3.0.0) ? | mod_breadcrumbs (3.0.0) ? | mod_related_items (3.0.0) ? | mod_tags_popular (3.1.0) ? |
3rd Party:: mod_virtuemart_product (3.6.2) ? | mod_virtuemart_cart (3.6.2) ? | mod_virtuemart_search (3.6.2) ? | AcyMailing Module (3.7.0) ? | Default Checkbox (1.0.0) ? | mod_virtuemart_manufacturer (3.6.2) ? | mod_virtuemart_category (3.6.2) ? | mod_virtuemart_currencies (3.6.2) ? | mod_loginModal (1.0.0) ? |

Modules :: ADMIN ::
Core :: mod_login (3.0.0) ? | mod_custom (3.0.0) ? | mod_latest (3.0.0) ? | mod_popular (3.0.0) ? | mod_feed (3.0.0) ? | mod_privacy_dashboard (3.9.0) ? | mod_menu (3.0.0) ? | mod_title (3.0.0) ? | mod_stats_admin (3.0.0) ? | mod_latestactions (3.9.0) ? | mod_toolbar (3.0.0) ? | mod_multilangstatus (3.0.0) ? | mod_sampledata (3.8.0) ? | mod_quickicon (3.0.0) ? | mod_version (3.0.0) ? | mod_logged (3.0.0) ? | mod_status (3.0.0) ? | mod_submenu (3.0.0) ? |
3rd Party:: VirtueMart Administrator Menu (3.6.2) ? | RSFirewall! Control Panel Module (1.4.0) ? |

Libraries ::
Core ::
3rd Party:: Free Mono (-) ? | Helvetica (-) ? |

Plugins ::
Core :: plg_search_content (3.0.0) ? | plg_search_categories (3.0.0) ? | plg_search_contacts (3.0.0) ? | plg_search_newsfeeds (3.0.0) ? | plg_search_tags (3.0.0) ? | plg_user_profile (3.0.0) ? | plg_user_joomla (3.0.0) ? | plg_user_terms (3.9.0) ? | plg_user_contactcreator (3.0.0) ? | plg_content_confirmconsent (3.9.0) ? | plg_content_vote (3.0.0) ? | plg_content_joomla (3.0.0) ? | plg_content_fields (3.7.0) ? | plg_content_pagenavigation (3.0.0) ? | plg_content_pagebreak (3.0.0) ? | plg_content_loadmodule (3.0.0) ? | plg_content_finder (3.0.0) ? | plg_content_emailcloak (3.0.0) ? | plg_privacy_user (3.9.0) ? | plg_privacy_content (3.9.0) ? | plg_privacy_actionlogs (3.9.0) ? | plg_privacy_consents (3.9.0) ? | plg_privacy_message (3.9.0) ? | plg_editors-xtd_readmore (3.0.0) ? | plg_editors-xtd_article (3.0.0) ? | plg_editors-xtd_fields (3.7.0) ? | plg_editors-xtd_menu (3.7.0) ? | plg_editors-xtd_pagebreak (3.0.0) ? | plg_editors-xtd_image (3.0.0) ? | plg_editors-xtd_module (3.5.0) ? | plg_fields_user (3.7.0) ? | plg_fields_url (3.7.0) ? | plg_fields_radio (3.7.0) ? | plg_fields_editor (3.7.0) ? | plg_fields_sql (3.7.0) ? | plg_fields_usergrouplist (3.7.0) ? | plg_fields_calendar (3.7.0) ? | plg_fields_imagelist (3.7.0) ? | plg_fields_list (3.7.0) ? | plg_fields_checkboxes (3.7.0) ? | plg_fields_media (3.7.0) ? | plg_fields_integer (3.7.0) ? | plg_fields_color (3.7.0) ? | plg_fields_textarea (3.7.0) ? | plg_fields_text (3.7.0) ? | plg_fields_repeatable (3.9.0) ? | plg_system_languagefilter (3.0.0) ? | plg_system_privacyconsent (3.9.0) ? | plg_system_logout (3.0.0) ? | plg_system_logrotation (3.9.0) ? | plg_system_sessiongc (3.8.6) ? | plg_system_redirect (3.0.0) ? | plg_system_fields (3.7.0) ? | plg_system_languagecode (3.0.0) ? | plg_system_cache (3.0.0) ? | PLG_SYSTEM_ACTIONLOGS (3.9.0) ? | plg_system_remember (3.0.0) ? | plg_system_sef (3.0.0) ? | plg_system_updatenotification (3.5.0) ? | plg_system_stats (3.5.0) ? | plg_system_log (3.0.0) ? | plg_system_debug (3.0.0) ? | plg_system_p3p (3.0.0) ? | plg_system_highlight (3.0.0) ? | plg_authentication_ldap (3.0.0) ? | plg_authentication_cookie (3.0.0) ? | plg_authentication_joomla (3.0.0) ? | plg_authentication_gmail (3.0.0) ? | plg_extension_joomla (3.0.0) ? | plg_installer_webinstaller (2.0.1) ? | PLG_INSTALLER_FOLDERINSTALLER (3.6.0) ? | plg_installer_packageinstaller (3.6.0) ? | PLG_INSTALLER_URLINSTALLER (3.6.0) ? | plg_twofactorauth_totp (3.2.0) ? | plg_twofactorauth_yubikey (3.2.0) ? | PLG_ACTIONLOG_JOOMLA (3.9.0) ? | plg_quickicon_privacycheck (3.9.0) ? | plg_quickicon_extensionupdate (3.0.0) ? | plg_quickicon_phpversioncheck (3.7.0) ? | plg_quickicon_joomlaupdate (3.0.0) ? | plg_finder_content (3.0.0) ? | plg_finder_categories (3.0.0) ? | plg_finder_contacts (3.0.0) ? | plg_finder_newsfeeds (3.0.0) ? | plg_finder_tags (3.0.0) ? | plg_captcha_recaptcha (3.4.0) ? | plg_captcha_recaptcha_invisible (3.8) ? |
3rd Party:: Search - VirtueMart (3.6.2) ? | JotLoadmodule (6.2.1) ? | VM - Calculation Avalara Tax (3.6.2) ? | AcyMailing Tag : Website links (3.7.0) ? | AcyMailing Tag : Subscriber informa (5.10.4) ? | AcyMailing Tag : Date / Time (5.10.4) ? | AcyMailing : trigger Joomla Content (3.7.0) ? | AcyMailing Manage text (1.0.0) ? | AcyMailing Template Class Replacer (5.10.4) ? | AcyMailing : Statistics Plugin (3.7.0) ? | AcyMailing Tag : content insertion (3.7.0) ? | AcyMailing Tag : Manage the Subscri (5.10.4) ? | AcyMailing : Handle Click tracking (5.8.1) ? | AcyMailing table of contents genera (1.0.0) ? | AcyMailing : share on social networ (1.0.0) ? | AcyMailing Tag : Joomla User Inform (5.10.4) ? | AcyMailing : Handle Click tracking (5.8.1) ? | AcyMailing: override Joomla mailing (5.8.1) ? | System - RSFirewall! Active Scanner (1.4.0) ? | JotMarker (6.2.1) ? | PLG_SYSTEM_JCH_OPTIMIZE (5.4.3) ? | JotCache (6.2.1) ? | AcyMailing : (auto)Subscribe during (5.10.4) ? | VM Framework Loader during Plugin U (1.0) ? | AcyMailing JCE integration (5.10.4) ? | AMAZON (3.4.2) ? | By weight, ZIP and countries (3.6.2) ? | plg_editors_tinymce (4.5.11) ? | AcyMailing Editor (5.10.4) ? | plg_editors_codemirror (5.40.0) ? | plg_installer_rsfirewall (1.0.0) ? | Realex_hpp_api (3.6.2) ? | Recache (6.2.1) ? | Crawler (6.2.1) ? | Crawler Extended (6.2.1) ? | VMCustom - textinput (3.6.2) ? | VM - Custom, Virtuemart Simple Down (${PHING.VERSI) ? | plgvm_specification (3.6.2) ? | VM Payment - eway (3.6.2) ? | 2Checkout (3.6.2) ? | PayPal (3.6.2) ? | VM Payment - Paybox (3.6.2) ? | Heidelpay (16.11.07) ? | Sofort Ideal (3.6.2) ? | Authorize.net AIM (3.6.2) ? | Eesti Pangaliit (1.0.1) ? | Klarna (3.6.2) ? | Sofort (3.6.2) ? | Skrill (3.6.2) ? | Klarna Checkout (3.6.2) ? | Standard (3.6.2) ? | realex_hpp_api (3.6.2) ? | AMAZON (3.4.2) ? | VM Payment - klikandpay (3.6.2) ? |
Templates Discovered :: wrote:Templates :: SITE :: protostar (1.0) ? | beez3 (3.1.0) ? | horme_3 (1.9.0) ? |
Templates :: ADMIN :: isis (1.0) ? | hathor (3.0.0) ? |
Last edited by toivo on Thu Oct 03, 2019 10:58 am, edited 1 time in total.
Reason: mod note: disabled smilies in post Options for readability

Cococoder
Joomla! Apprentice
Joomla! Apprentice
Posts: 9
Joined: Wed Oct 02, 2019 9:48 am

Re: Unecessary call to /component/ajax/?format=json on every page

Post by Cococoder » Thu Oct 03, 2019 10:30 am

More info. the call to is generated in the page header:
<script type="application/json" class="joomla-script-options new">{"csrf.token":"SomeToken","system.paths":{"root":"","base":""},"system.keepalive":{"interval":300000,"uri":"\/component\/ajax\/?format=json"}}</script> It seems to me it belongs to the joomla core but I might be mistaken.
In any case I don't see any valid reason to hardcode a trailing slash in that specific case. So my goal is to find out where this code is generated and override it with a version without trailing slash. In other words my goal is not to get the read of the redirect per se but to get the read of the trailing slash in the code, so basically I'll have "\/component\/ajax?format=json" instead of what is above. Any pointer to where is generate this script?

Cococoder
Joomla! Apprentice
Joomla! Apprentice
Posts: 9
Joined: Wed Oct 02, 2019 9:48 am

Re: Unecessary call to /component/ajax/?format=json on every page

Post by Cococoder » Thu Oct 03, 2019 10:54 am

mbabker wrote:
Wed Oct 02, 2019 9:41 pm
Well aware. I'm also aware of how often an FPA is posted and people spend time nit-picking over details in it unrelated to the OP's issue and completely ignoring the last PHP error (the first thing displayed) when it actually does relate to the issue. Yeah, it's a good tool for helping with deeper diagnostics, but unless it's spitting out component configurations or .htaccess file contents, this is an occasion where asking for it is overkill. Now, if the OP here wants to come back and say they have no idea what's on their site to deal with URL rewriting related issues, then sure, the FPA will help identify that.
Thanks, I appreciate this way of thinking and how you mind how my concern will be approached by the community. I posted the FPA in case the list of modules and plugins help.

Cococoder
Joomla! Apprentice
Joomla! Apprentice
Posts: 9
Joined: Wed Oct 02, 2019 9:48 am

Re: Unecessary call to /component/ajax/?format=json on every page

Post by Cococoder » Thu Oct 03, 2019 12:35 pm

Gone deeper in my investigation. This code is generated in libraries/src/Document/Renderer/Html/HeaderRenderer.php line 250
if (!empty($scriptOptions))
{
$buffer .= $tab . '<script type="application/json" class="joomla-script-options new">';

$prettyPrint = (JDEBUG && defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : false);
$jsonOptions = json_encode($scriptOptions, $prettyPrint);
$jsonOptions = $jsonOptions ? $jsonOptions : '{}';

$buffer .= $jsonOptions;
$buffer .= '</script>' . $lnEnd;
}
Looking for $jsonOptions you can find that $jsonOptions=$options['json_options'] in fof/hal/render/json.php line 58. That's as far as I have been so far. The hunt continues. Where are the json options stored?

Cococoder
Joomla! Apprentice
Joomla! Apprentice
Posts: 9
Joined: Wed Oct 02, 2019 9:48 am

Re: Unecessary call to /component/ajax/?format=json on every page

Post by Cococoder » Thu Oct 03, 2019 12:44 pm

SharkyKZ wrote:
Wed Oct 02, 2019 5:52 pm
I have the same link but it does not perform a redirect. Do you have any other extensions installed? Any SEO extensions?
Thanks for taking the time to check on your own website if you have the same. As I stated above I have an htaccess directive that strip the trailing slash. The question is why is there a trailing slash hardcoded. I don't think this is useful. I am stripping trailing slash as google treats URL with trailing slash and without as two distinct pages and those versions are crawled independently. I want to make sure google robots crawl budget is used optimally on my site, I stripped the trailing slash so it spend time discovering new pages instead of exploring two times the same resources.

Cococoder
Joomla! Apprentice
Joomla! Apprentice
Posts: 9
Joined: Wed Oct 02, 2019 9:48 am

Re: Unecessary call to /component/ajax/?format=json on every page

Post by Cococoder » Thu Oct 03, 2019 1:14 pm

Closing in:
Line 713 in cms/html/behavior.php
// If we are in the frontend or logged in as a user, we can use the ajax component to reduce the load
$uri = 'index.php' . (JFactory::getApplication()->isClient('site') || !JFactory::getUser()->guest ? '?option=com_ajax&format=json' : '');
// Add keepalive script options.
JFactory::getDocument()->addScriptOptions('system.keepalive', array('interval' => $refreshTime * 1000, 'uri' => JRoute::_($uri)));
I am afraid the trailing slash comes from the way the uri is formed. Instead of adding a slash at the begining of the subdirectory string it is added to the end of the string. In that case it will all boil done to modifying how JRoute operate. Joomal team, is this doable?

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

Re: Unecessary call to /component/ajax/?format=json on every page

Post by Webdongle » Thu Oct 03, 2019 1:55 pm

Was this a 3rd party install or did you download it from https://downloads.joomla.org/ ?
Try setting Protostar as default Template.
Try disabling JCHoptimize then clearing Joomla cache.
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"The definition of insanity is doing the same thing over and over again, but expecting different results": Albert Einstein

User avatar
brian
Joomla! Master
Joomla! Master
Posts: 11768
Joined: Fri Aug 12, 2005 7:19 am
Location: Leeds, UK
Contact:

Re: Unecessary call to /component/ajax/?format=json on every page

Post by brian » Thu Oct 03, 2019 6:56 pm

the problem is from the htaccess !!
"Exploited yesterday... Hacked tomorrow"
Blog http://brian.teeman.net/
Joomla Hidden Secrets http://hiddenjoomlasecrets.com/

Cococoder
Joomla! Apprentice
Joomla! Apprentice
Posts: 9
Joined: Wed Oct 02, 2019 9:48 am

Re: Unecessary call to /component/ajax/?format=json on every page

Post by Cococoder » Fri Oct 04, 2019 11:41 am

brian wrote:
Thu Oct 03, 2019 6:56 pm
the problem is from the htaccess !!
I should edit the subject. The reason why I have this htaccess directive is that I had numerous pages indexed both with and without trailing slash. As my site has many pages, I chosed to remove trailing slash for none existing directories (it's a while I did this change so I don't remember the details but at the time I didn't find a better alternative). Now, I noticed this relatively small thing (I can barely call it an issue) and I'd like to fix it, but not at the expense of removing trailing slash. Changing JRoute to accomodate this htaccess directive seems legit. I don't know how hard it is technically though.


Post Reply

Return to “Performance - Joomla! 3.x”