4

Magento2.3 homepage redirects to 404 page not found. And this only occurs when (not logged in, only in desktop view) in site. After logged in, homepage working properly. And also work in mobile view.

And also after clear page-cache, homepage working properly.

Does anyone has faced this type of issue?

  • Have you found a cause for this issue? I'm also facing it. It happens randomly, without having any empty records in url_rewrites, and goes back to normal after clearing the cache. Thanks! – Robert Schmidt Mar 11 at 4:57
  • No, we tried to trace it. Do you face from how many time? – Emipro Technologies Pvt. Ltd. Mar 11 at 5:03
  • You do not need to clear all cache. We traced that after clear only full page cache, It's also working. php bin/magento cache:clean full_page – Emipro Technologies Pvt. Ltd. Mar 11 at 5:06
  • It happens completely random, without anything logged. I opened an issue on github, maybe you can post your input there as well: github.com/magento/magento2/issues/21703 – Robert Schmidt Mar 12 at 5:11
1

Enter in you database and run this :

SELECT * FROM `url_rewrite` WHERE request_path='';

Delete the rows and after that do :

php bin/magento setup:upgrade
php bin/magento cache:flush
  • Disable the Page Cache , and see if the error persist .

  • Check if you have redis cache , and clean it .

  • See the template assigned in homepage , check the console for any errors.
1

We also have this problem on 3 separate installations of Magento 2.3, all on different servers.

This has only happened since the upgrade from 2.2.6 and seems to occur at exactly the same point in time every day (no errors in any logs).

Clearing the cache fixes the issue, but not the problem.

  • Have you found what was the exact issue? – Emipro Technologies Pvt. Ltd. Mar 4 at 6:51
  • No, not yet, we just added a scheduled task which checks for a 404 every minute and refreshes the cache if found. Not ideal, but the best fix we could find. Only happened since the upgrade to Magento 2.3 though. – Dan Mar 12 at 8:51
1

check url_rewrite table , into that table home page blank request_path entry there and removed that entry, then check

php bin/magento cache:flush
php bin/magento cache:clean
0

Looks like this is caused by Magento 2 full page cache bug in muti-store views. I have disabled the full page cache from env.php. It seems to fixes the issue. Have to debug more to find out.

Will update you guys soon.

  • did you found any solution for full page cache 404 issue on home page ? I have facing same issues on home page where somtimes homepage will be 404 and if i clean full page cache, it's working fine. – Ajay 2 days ago
0

We are facing the same issue as well and it still needs to be debugged in detail. But we are using below as the temporary fix

Modify 'aroundDispatch' method of file vendor/magento/module-page-cache/Model/App/FrontController/BuiltinPlugin.php like below

public function aroundDispatch(
        \Magento\Framework\App\FrontControllerInterface $subject,
        \Closure $proceed,
        \Magento\Framework\App\RequestInterface $request
    ) {
        $this->version->process();
        if (!$this->config->isEnabled() || $this->config->getType() != \Magento\PageCache\Model\Config::BUILT_IN) {
            return $proceed($request);
        }
        $result = $this->kernel->load();
        if ($result === false || ($result instanceof ResponseHttp && $result->getStatusCode() == 404)) {
            $result = $proceed($request);
            if ($result instanceof ResponseHttp) {
                $this->addDebugHeaders($result);
                $this->kernel->process($result);
            }
        } else {
            $this->addDebugHeader($result, 'X-Magento-Cache-Debug', 'HIT', true);
        }
        return $result;
    }

The change in function is: IF condition changed from

if ($result === false) {

to

if ($result === false || ($result instanceof ResponseHttp && $result->getStatusCode() == 404)) {

This code change will ignore full page cache if the result found in the cache is 404.

I hope this helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.