clean-docker / Magento2

Docker Image to Magento 2 local development in Mac, Linux and Windows
https://hub.docker.com/r/rafaelcgstz/magento2/
MIT License
444 stars 251 forks source link

Frontend Session Issue #61

Open iedev1 opened 6 years ago

iedev1 commented 6 years ago

Hi

I've setup and installed Magento and can successfully log into the backend and perform admin tasks.

However, when it comes to the frontend I cannot add items to the cart or create a new account.

When adding an item the "Add Item" button just spins and loads although looking at the request tab the request completes. When creating a new account from the frontend the page simply reloads with all registration fields being empty.

I've tried modifying the src/app/etc/env.php file, setting the value of the session key to

I'd appreciate any help.

Thanks a lot for making this by the way.

iedev1 commented 6 years ago

I added the following to the config (src/app/etch/env.php) and made sure that the session folder is writeable (works for backed sessions)

'save' => 'files', 'save_path' => '/var/www/html/var/session/',

Still no luck.

I then tried the site in Safari and it worked. I've tested in Chrome and Firefox and the session issue exist there. I've tried disabling plugins in Chrome to no avail.

So still not sure what causes this. Admin sessions work in all browsers.

nickgraz commented 6 years ago

@iedev1 I was just having the same issue. Can you try setting a real site URL? It worked for me.

docker exec -it magento2_db_1 /bin/bash - make sure you get the right container name mysql -uroot -proot magento - log in to MySQL update core_config_data set value = replace(value, 'localhost', 'localmagento.com'); - Update base URL from "localhost" to "localmagento.com"

Clear cache inside Apache container docker exec -it magento2_apache_1 /bin/bash - make sure you get the right container name ./bin/magento cache:flush

You will need to have a line like this in your host machine's /etc/hosts: 127.0.0.1 localmagento.com

This should fix your problem... let me know how it goes.

@rafaelstz can you parameterize the dev URL so that it works out of the box on Chrome?