Strange cache behaviour with BaseUrl

I have some code in my theme plugin that looks for the most popular articles and stores their details in the cache, if not already cached, or retrieves from the cache if it is already cached.

The moment this information gets cached for the first time, everything works fine, but after 24 hours the URL addresses change from using the baseUrl to using the server IP address, breaking the links with a “net::ERR_CERT_COMMON_NAME_INVALID” error.

$popularArticles[$result['submission_id']]['thumbnail'] = $request->getBaseUrl() . '/' . $publicFileManager->getContextFilesPath($context->getId()).'/'.$publishedArticle->getLocalizedCoverImage();

After 24 hours the url changes to use the IP address instead of the canonical url of the journal. Very strange.

Does anyone have any ideas about this?

I am using OJS currently.

Quick update with this one - I can’t explain the cache behaviour, but implemented a workaround just taking the baseurl from the config settings, which is working.

This topic was automatically closed after 6 days. New replies are no longer allowed.