aimeos / aimeos-laravel

Laravel ecommerce package for ultra fast online shops, scalable marketplaces, complex B2B applications and #gigacommerce
https://aimeos.org/Laravel
MIT License
7.31k stars 1.05k forks source link

Home page reload itself #398

Closed michele-grifa closed 3 years ago

michele-grifa commented 3 years ago

Environment

  1. Version: 2021.07.04
  2. Operating system: Linux
  3. Php Version: 8.0.9

Describe the bug When i use the following command, artisan serve --host=192.168.0.34 --port=8000, to start the integrated server instead of artisan serve, when i open the home page, it reload itself infinitely until i stop the artisan command. The admin page doesn't have this problem.

To Reproduce Steps to reproduce the behavior:

  1. Start the integrated server with the command artisan serve --host=YOURIP --port=8000 or any host different than 127.0.0.1
  2. Go on the home page
  3. The page reload infinitely

Expected behavior The page should not reload itself

aimeos commented 3 years ago

Tried with artisan serve --host=127.0.0.2 --port=8000 and doesn't reload so maybe it has something to do with the IP you are using. Is that the IP of the real network adapter?

michele-grifa commented 3 years ago

Yes, is a real adapter

aimeos commented 3 years ago

Also tried that and worked without problems

michele-grifa commented 3 years ago

Is a strange problem, maybe is the laravel version? Now is 6.20.31

aimeos commented 3 years ago

6.20.31 works perfectly in our tests

michele-grifa commented 3 years ago

After some test, i found out that the problem occur even without the host and port parameters. The problem happen when i log out from the site. If i login, the home doesn't refresh itself anymore.

aimeos commented 3 years ago

We've also noticed no problems in this scenario in our tests

michele-grifa commented 3 years ago

I have also tried to recreate the project, re-download composer packages and reinstall php but the same problem occurs when i'm not logged as a customer.

aimeos commented 3 years ago

Did you start the integrated PHP web server without the artisan command for testing (php -S 192.168.0.34:8000 -t public)? What's the HTTP response in the network tab of the browser console?

michele-grifa commented 3 years ago

This is the network tab response: network tab

After this response, the page reload itself.

This is the command line:

[Mon Aug 16 10:20:27 2021] 192.168.0.34:46978 [200]: GET /
[Mon Aug 16 10:20:27 2021] 192.168.0.34:46978 Closing
[Mon Aug 16 10:20:27 2021] 192.168.0.34:46988 Accepted
[Mon Aug 16 10:20:27 2021] 192.168.0.34:46988 [200]: GET /shop/count
[Mon Aug 16 10:20:27 2021] 192.168.0.34:46988 Closing
[Mon Aug 16 10:20:27 2021] 192.168.0.34:46990 Accepted
[Mon Aug 16 10:20:27 2021] 192.168.0.34:46992 Accepted
[Mon Aug 16 10:20:27 2021] 192.168.0.34:46990 [200]: GET /vendor/shop/themes/default/fonts/roboto-condensed-v19-latin/roboto-condensed-v19-latin-regular.woff2
[Mon Aug 16 10:20:27 2021] 192.168.0.34:46994 Accepted
[Mon Aug 16 10:20:27 2021] 192.168.0.34:46992 [200]: GET /vendor/shop/themes/default/fonts/roboto-condensed-v19-latin/roboto-condensed-v19-latin-700.woff2
[Mon Aug 16 10:20:27 2021] 192.168.0.34:47000 Accepted
[Mon Aug 16 10:20:27 2021] 192.168.0.34:46994 [200]: GET /vendor/shop/themes/default/fonts/bootstrap-icons.woff2
[Mon Aug 16 10:20:27 2021] 192.168.0.34:47002 Accepted
[Mon Aug 16 10:20:27 2021] 192.168.0.34:46990 Closing
[Mon Aug 16 10:20:27 2021] 192.168.0.34:47000 [200]: GET /vendor/shop/themes/default/aimeos.css
[Mon Aug 16 10:20:27 2021] 192.168.0.34:46992 Closing
[Mon Aug 16 10:20:27 2021] 192.168.0.34:47002 [200]: GET /vendor/shop/themes/default/aimeos.js
[Mon Aug 16 10:20:27 2021] 192.168.0.34:46994 Closing
[Mon Aug 16 10:20:27 2021] 192.168.0.34:47000 Closing
[Mon Aug 16 10:20:27 2021] 192.168.0.34:47002 Closing
[Mon Aug 16 10:20:27 2021] 192.168.0.34:47010 Accepted
[Mon Aug 16 10:20:27 2021] 192.168.0.34:47010 [200]: GET /vendor/shop/themes/default/media/header-bg.jpg
[Mon Aug 16 10:20:27 2021] 192.168.0.34:47010 Closing
[Mon Aug 16 10:20:27 2021] 192.168.0.34:47012 Accepted
[Mon Aug 16 10:20:27 2021] 192.168.0.34:47012 [200]: GET /vendor/shop/themes/default/media/progress.gif
[Mon Aug 16 10:20:27 2021] 192.168.0.34:47012 Closing
aimeos commented 3 years ago

The initiator of the first line looks strange. Does that also happen if you don't use the integrated PHP web server but Apache or Nginx listening on that IP address?

michele-grifa commented 3 years ago

The problem is the same using Apache

aimeos commented 3 years ago

Does it also happen when you install Aimeos on a public server?

michele-grifa commented 3 years ago

I cannot test on a public server. I just started using Aimeos and wanted to test locally what it can do.

aimeos commented 3 years ago

Then use localhost for testing (without IP) which works without problems according to your initial comment

michele-grifa commented 3 years ago

Yes now work locally also with IP, but only when i'm logged in and refresh using CTRL+F5. When i'm logged in, this is the network tab network tab 1

aimeos commented 3 years ago

Yes, that output look normal.

aimeos commented 3 years ago

Do you have aimeos/ai-cms-grapesjs package installed? If yes, can you please execute:

composer req aimeos/ai-cms-grapesjs:2021.07.x-dev

Maybe that fixes the problem.

michele-grifa commented 3 years ago

I executed the command but without changes.

aimeos commented 3 years ago

You should get commit d98d9ff0b572182f6d06351cb8ce253d59672c0c (Avoid reloading home page if path is "/"): https://packagist.org/packages/aimeos/ai-cms-grapesjs#2021.07.x-dev

michele-grifa commented 3 years ago

I did it, but same behavior

michele-grifa commented 3 years ago

After i executed the aimeos:clear command and revert back to 2021.07.5, the problem seems to be resolved, but now on the home page, the account dropdown menu not show any link. Schermata del 2021-08-18 10-14-51

aimeos commented 3 years ago

Please run composer up again to install the latest aimeos/ai-client-html package.

michele-grifa commented 3 years ago

Thanks for the help. The issue is resolved.

aimeos commented 3 years ago

It wasn't resolved completely and you should update aimeos/ai-cms-grapesjs to version 2021.07.7 or later

waliurrahman commented 2 years ago

Does it also happen when you install Aimeos on a public server?

Yes, i am having this problem on production server :(

aimeos commented 2 years ago

What's the output of composer show?

waliurrahman commented 2 years ago

image aimeos/ai-admin-jqadm 2021.10.9 Aimeos Vue.js+Bootstrap admin interface aimeos/ai-admin-jsonadm 2021.10.3 Aimeos ai-admin-jsonadm extension aimeos/ai-client-html 2021.10.10 Aimeos ai-client-html extension aimeos/ai-client-jsonapi 2021.10.2 Aimeos JSON API extension aimeos/ai-cms-grapesjs 2021.10.4 Aimeos GrapesJS CMS extension aimeos/ai-controller-frontend 2021.10.3 Aimeos ai-controller-frontend extension aimeos/ai-controller-jobs 2021.10.5 Aimeos ai-controller-jobs extension aimeos/ai-gettext 2021.10.2 Aimeos Gettext extension aimeos/ai-laravel 2021.10.1 Laravel adapter for Aimeos web shops and e-commerce solutions aimeos/ai-swiftmailer 2021.10.1 SwiftMailer adapter for Aimeos web shops and e-commerce solutions aimeos/aimeos-core 2021.10.12 Full-featured e-commerce components for high performance online shops aimeos/aimeos-laravel 2021.10.4 Professional, full-featured and high performance Laravel e-commerce package for online shops and complex B2B projects aimeos/map 2.6.1 Easy and elegant handling of PHP arrays as array-like map objects similar to jQuery and Laravel Collections asm89/stack-cors v2.1.1 Cross-origin resource sharing library and stack middleware brick/math 0.9.3 Arbitrary-precision arithmetic library dflydev/dot-access-data v3.0.1 Given a deep data structure, access data by dot notation. doctrine/cache 2.1.1 PHP Doctrine Cache library is a popular cache implementation that supports many different drivers such as redis, memc... doctrine/dbal 2.13.7 Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management. doctrine/deprecations v0.5.3 A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or... doctrine/event-manager 1.1.1 The Doctrine Event Manager is a simple PHP event system that was built to be used with the various Doctrine projects. doctrine/inflector 2.0.4 PHP Doctrine Inflector is a small library that can perform string manipulations with regard to upper/lowercase and si... doctrine/instantiator 1.4.0 A small, lightweight utility to instantiate objects in PHP without invoking their constructors doctrine/lexer 1.2.2 PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers. dragonmantank/cron-expression v3.3.1 CRON for PHP: Calculate the next or previous run date and determine if a CRON expression is due egulias/email-validator 2.1.25 A library for validating emails against several RFCs enshrined/svg-sanitize 0.14.1 An SVG sanitizer for PHP facade/flare-client-php 1.9.1 Send PHP errors to Flare facade/ignition 2.17.4 A beautiful error page for Laravel applications. facade/ignition-contracts 1.0.2 Solution contracts for Ignition fakerphp/faker v1.18.0 Faker is a PHP library that generates fake data for you. filp/whoops 2.14.5 php error handling for cool kids fruitcake/laravel-cors v2.0.5 Adds CORS (Cross-Origin Resource Sharing) headers support in your Laravel application graham-campbell/result-type v1.0.4 An Implementation Of The Result Type guzzlehttp/guzzle 7.4.1 Guzzle is a PHP HTTP client library guzzlehttp/promises 1.5.1 Guzzle promises library guzzlehttp/psr7 2.1.0 PSR-7 message implementation that also provides common utility methods hamcrest/hamcrest-php v2.0.1 This is the PHP port of Hamcrest Matchers laminas/laminas-diactoros 2.8.0 PSR HTTP Message implementations laravel/framework v8.81.0 The Laravel Framework. laravel/sail v1.13.1 Docker files for running a basic Laravel application. laravel/sanctum v2.14.0 Laravel Sanctum provides a featherweight authentication system for SPAs and simple APIs. laravel/serializable-closure v1.0.5 Laravel Serializable Closure provides an easy and secure way to serialize closures in PHP. laravel/tinker v2.7.0 Powerful REPL for the Laravel framework. laravel/ui v3.4.2 Laravel UI utilities and presets. league/commonmark 2.2.1 Highly-extensible PHP Markdown parser which fully supports the CommonMark spec and GitHub-Flavored Markdown (GFM) league/config v1.1.1 Define configuration arrays with strict schemas and access values with dot notation league/flysystem 1.1.9 Filesystem abstraction: Many filesystems, one API. league/mime-type-detection 1.9.0 Mime-type detection for Flysystem mockery/mockery 1.5.0 Mockery is a simple yet flexible PHP mock object framework monolog/monolog 2.3.5 Sends your logs to files, sockets, inboxes, databases and various web services myclabs/deep-copy 1.10.2 Create deep copies (clones) of your objects nesbot/carbon 2.56.0 An API extension for DateTime that supports 281 different languages. nette/schema v1.2.2 📐 Nette Schema: validating data structures against a given Schema. nette/utils v3.2.7 🛠 Nette Utils: lightweight utilities for string & array manipulation, image handling, safe JSON encoding/decoding... nikic/php-parser v4.13.2 A PHP parser written in PHP nunomaduro/collision v5.11.0 Cli error handling for console/command-line PHP applications. nyholm/psr7 1.4.1 A fast PHP7 implementation of PSR-7 opis/closure 3.6.2 A library that can be used to serialize closures (anonymous functions) and arbitrary objects. phar-io/manifest 2.0.3 Component for reading phar.io manifest information from a PHP Archive (PHAR) phar-io/version 3.1.0 Library for handling version information and constraints php-http/message-factory v1.0.2 Factory interfaces for PSR-7 HTTP Message phpdocumentor/reflection-common 2.2.0 Common reflection classes used by phpdocumentor to reflect the code structure phpdocumentor/reflection-docblock 5.3.0 With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information th... phpdocumentor/type-resolver 1.6.0 A PSR-5 based resolver of Class names, Types and Structural Element Names phpoption/phpoption 1.8.1 Option Type for PHP phpspec/prophecy v1.15.0 Highly opinionated mocking framework for PHP 5.3+ phpunit/php-code-coverage 9.2.10 Library that provides collection, processing, and rendering functionality for PHP code coverage information. phpunit/php-file-iterator 3.0.6 FilterIterator implementation that filters files based on a list of suffixes. phpunit/php-invoker 3.1.1 Invoke callables with a timeout phpunit/php-text-template 2.0.4 Simple template engine. phpunit/php-timer 5.0.3 Utility class for timing phpunit/phpunit 9.5.13 The PHP Unit Testing framework. psr/container 1.1.2 Common Container Interface (PHP FIG PSR-11) psr/event-dispatcher 1.0.0 Standard interfaces for event handling. psr/http-client 1.0.1 Common interface for HTTP clients psr/http-factory 1.0.1 Common interfaces for PSR-7 HTTP message factories psr/http-message 1.0.1 Common interface for HTTP messages psr/log 1.1.4 Common interface for logging libraries psr/simple-cache 1.0.1 Common interfaces for simple caching psy/psysh v0.11.1 An interactive shell for modern PHP. ralouphie/getallheaders 3.0.3 A polyfill for getallheaders. ramsey/collection 1.2.2 A PHP library for representing and manipulating collections. ramsey/uuid 4.2.3 A PHP library for generating and working with universally unique identifiers (UUIDs). sebastian/cli-parser 1.0.1 Library for parsing CLI options sebastian/code-unit 1.0.8 Collection of value objects that represent the PHP code units sebastian/code-unit-reverse-lookup 2.0.3 Looks up which function or method a line of code belongs to sebastian/comparator 4.0.6 Provides the functionality to compare PHP values for equality sebastian/complexity 2.0.2 Library for calculating the complexity of PHP code units sebastian/diff 4.0.4 Diff implementation sebastian/environment 5.1.3 Provides functionality to handle HHVM/PHP environments sebastian/exporter 4.0.4 Provides the functionality to export PHP variables for visualization sebastian/global-state 5.0.3 Snapshotting of global state sebastian/lines-of-code 1.0.3 Library for counting the lines of code in PHP source code sebastian/object-enumerator 4.0.4 Traverses array structures and object graphs to enumerate all referenced objects sebastian/object-reflector 2.0.4 Allows reflection of object attributes, including inherited and non-public ones sebastian/recursion-context 4.0.4 Provides functionality to recursively process PHP variables sebastian/resource-operations 3.0.3 Provides a list of PHP built-in functions that operate on resources sebastian/type 2.3.4 Collection of value objects that represent the types of the PHP type system sebastian/version 3.0.2 Library that helps with managing the version number of Git-hosted PHP projects swiftmailer/swiftmailer v6.3.0 Swiftmailer, free feature-rich PHP mailer symfony/console v5.4.2 Eases the creation of beautiful and testable command line interfaces symfony/css-selector v5.4.2 Converts CSS selectors to XPath expressions symfony/deprecation-contracts v2.5.0 A generic function and convention to trigger deprecation notices symfony/error-handler v5.4.2 Provides tools to manage errors and ease debugging PHP code symfony/event-dispatcher v5.4.0 Provides tools that allow your application components to communicate with each other by dispatching events and listen... symfony/event-dispatcher-contracts v2.5.0 Generic abstractions related to dispatching event symfony/finder v5.4.2 Finds files and directories via an intuitive fluent interface symfony/http-foundation v5.4.2 Defines an object-oriented layer for the HTTP specification symfony/http-kernel v5.4.2 Provides a structured process for converting a Request into a Response symfony/mime v5.4.2 Allows manipulating MIME messages symfony/polyfill-ctype v1.24.0 Symfony polyfill for ctype functions symfony/polyfill-iconv v1.24.0 Symfony polyfill for the Iconv extension symfony/polyfill-intl-grapheme v1.24.0 Symfony polyfill for intl's grapheme_* functions symfony/polyfill-intl-idn v1.24.0 Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions symfony/polyfill-intl-normalizer v1.24.0 Symfony polyfill for intl's Normalizer class and related functions symfony/polyfill-mbstring v1.24.0 Symfony polyfill for the Mbstring extension symfony/polyfill-php72 v1.24.0 Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions symfony/polyfill-php73 v1.24.0 Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions symfony/polyfill-php80 v1.24.0 Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions symfony/polyfill-php81 v1.24.0 Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions symfony/process v5.4.2 Executes commands in sub-processes symfony/psr-http-message-bridge v2.1.2 PSR HTTP message bridge symfony/routing v5.4.0 Maps an HTTP request to a set of configuration variables symfony/service-contracts v2.5.0 Generic abstractions related to writing services symfony/string v5.4.2 Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified... symfony/translation v5.4.2 Provides tools to internationalize your application symfony/translation-contracts v2.5.0 Generic abstractions related to translation symfony/var-dumper v5.4.2 Provides mechanisms for walking through any arbitrary PHP variable tecnickcom/tcpdf 6.4.4 TCPDF is a PHP class for generating PDF documents and barcodes. theseer/tokenizer 1.2.1 A small library for converting tokenized PHP source code into XML and potentially other formats tijsverkoyen/css-to-inline-styles 2.2.4 CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-pages/files with inline styles. T... vlucas/phpdotenv v5.4.1 Loads environment variables from .env to getenv(), $_ENV and $_SERVER automagically. voku/portable-ascii 1.6.1 Portable ASCII library - performance optimized (ascii) string functions for php. webmozart/assert 1.10.0 Assertions to validate method input/output with nice error messages. root@ip-172-26-1-239:/opt/bitnami/nginx/html/source#

waliurrahman commented 2 years ago

I found this line at: ./vendor/aimeos/ai-cms-grapesjs/client/html/templates/cms/page/header-standard.php

<?php elseif( strlen( trim( $this->param( 'path' ), '/' ) ) > 0 ) : ?>

    <title><?= $enc->html( $this->get( 'contextSiteLabel', 'Aimeos' ) ) ?></title>

    <meta name="application-name" content="Aimeos" />
    <meta http-equiv="refresh" content="0;URL='/'" />  (---------> THIS LINE)
    <meta name="robots" content="noindex" />

<?php endif; ?>

<?= $this->get( 'pageHeader' ); ?>

Which might be reloading the page. Removed the line, but nothing changes on front end 😢

aimeos commented 2 years ago

The content is cached by default. You can clear the cache using: php artisan aimeos:clear

More questions:

waliurrahman commented 2 years ago

@aimeos

The content is cached by default. You can clear the cache using: php artisan aimeos:clear

That's Great! Seems working now. As I have commented that line above, clearing the cache did the trick. Thanks a lot. But from where <meta http-equiv="refresh" content="0;URL='/'" /> came into my code on the first place? why? do u know?

More questions:

  • Do you have CMS content at your home page?

Yes! here is my homepage content: image

  • Can you check what $this->param( 'path' ) returns and why the elseif code is executed?

This is my whole code:

<?php

/**
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
 * @copyright Aimeos (aimeos.org), 2021
 */

$enc = $this->encoder();

$target = $this->config( 'client/html/cms/page/url/target' );
$cntl = $this->config( 'client/html/cms/page/url/controller', 'cms' );
$action = $this->config( 'client/html/cms/page/url/action', 'page' );
$config = $this->config( 'client/html/cms/page/url/config', [] );

/** client/html/cms/page/metatags
 * Adds the title, meta and link tags to the HTML header
 *
 * By default, each instance of the cms list component adds some HTML meta
 * tags to the page head section, like page title, meta keywords and description
 * as well as some link tags to support browser navigation. If several instances
 * are placed on one page, this leads to adding several title and meta tags used
 * by search engine. This setting enables you to suppress these tags in the page
 * header and maybe add your own to the page manually.
 *
 * @param boolean True to display the meta tags, false to hide it
 * @since 2021.01
 * @category Developer
 * @category User
 * @see client/html/cms/lists/metatags
 */

?>
<?php if( isset( $this->pageCmsItem ) ) : ?>

    <?php if( (bool) $this->config( 'client/html/cms/page/metatags', true ) === true ) : ?>

        <title><?= $enc->html( strip_tags( $this->pageCmsItem->getName() ) ) ?> | <?= $enc->html( $this->get( 'contextSiteLabel', 'Aimeos' ) ) ?></title>

        <link rel="canonical" href="<?= $enc->attr( $this->url( $target, $cntl, $action, ['path' => $this->pageCmsItem->getUrl()], $config + ['absoluteUri' => true] ) ); ?>" />

        <meta property="og:type" content="article" />
        <meta property="og:title" content="<?= $enc->attr( $this->pageCmsItem->getName() ); ?>" />
        <meta property="og:url" content="<?= $enc->attr( $this->url( $target, $cntl, $action, ['path' => $this->pageCmsItem->getUrl()], $config + ['absoluteUri' => true] ) ); ?>" />

        <?php foreach( $this->pageCmsItem->getRefItems( 'media', 'default', 'default' ) as $mediaItem ) : ?>
            <meta property="og:image" content="<?= $enc->attr( $this->content( $mediaItem->getUrl() ) ) ?>" />
        <?php endforeach ?>

        <?php foreach( $this->pageCmsItem->getRefItems( 'text', 'meta-description', 'default' ) as $textItem ) : ?>
            <meta property="og:description" content="<?= $enc->attr( $textItem->getContent() ) ?>" />
            <meta name="description" content="<?= $enc->attr( strip_tags( $textItem->getContent() ) ); ?>" />
        <?php endforeach ?>

        <?php foreach( $this->pageCmsItem->getRefItems( 'text', 'meta-keyword', 'default' ) as $textItem ) : ?>
            <meta name="keywords" content="<?= $enc->attr( strip_tags( $textItem->getContent() ) ); ?>" />
        <?php endforeach; ?>

        <meta name="twitter:card" content="summary_large_image" />

    <?php endif; ?>

<?php elseif( strlen( trim( $this->param( 'path' ), '/' ) ) > 0 ) : ?>

    <title><?= $enc->html( $this->get( 'contextSiteLabel', 'Aimeos' ) ) ?></title>

    <meta name="application-name" content="Aimeos" />
    <!-- <meta http-equiv="refresh" content="0;URL='/'" /> -->
    <meta name="robots" content="noindex" />

<?php endif; ?>

<?= $this->get( 'pageHeader' ); ?>
waliurrahman commented 2 years ago

Running on AWS Lightsail NGINX Instance

aimeos commented 2 years ago

Can you please add this after <?php elseif(...) ?>:

<?php echo 'testpath: '; var_dump($this->param( 'path' )) ?>

Then, clear the cache again and check if the output contains "testpath" and a value. If yes, please post it.

waliurrahman commented 2 years ago

Can't see where it is... But what I didn't notice earlier that both inside and outside the if statement is executing. Have a look please: image

aimeos commented 2 years ago

We removed the redirect due to multiple issues now. Please run composer up to get the latest version.

waliurrahman commented 2 years ago

@aimeos Thanks a lot. Glad you guys did this 😄 ❤️