Losing session at basket modification

Help for integrating the Laravel package
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
User avatar
Wall0fDeath
Posts: 28
Joined: 30 Aug 2022, 13:56

Losing session at basket modification

Post by Wall0fDeath » 16 Oct 2023, 09:35

Php : 8.2
Os: Debian GNU/Linux 11 (Bullseye)
Aimeos 22.10.12
Laravel 9.52.16

Dear Aimeos Team,

I have a weird problem when I try to run the shop with "nginx and php 8.2 fpm":

- When I click to add a product to the basket(or any basket action, or checkout), it does, but i will lose my session after the click to these actions. I saw 2 product on the mini basket and when I add 1 product, it changes to 0 and at the next request, what needs login i will get 419 error, or it just redirects me out to login.

If I do the same with "php artisan serve" instead of nginx, it works normally, I won't lose my session, i can modify basket, make an order etc.
I have checked every log, both for laravel, and nginx, but nothing seems to be related to this.


May I ask your idea about this?

User avatar
Wall0fDeath
Posts: 28
Joined: 30 Aug 2022, 13:56

Re: Losing session at basket modification

Post by Wall0fDeath » 16 Oct 2023, 10:20

Nginx conf relevant part for php:

Code: Select all

  location ~ \.php$ {
    satisfy any;
## -- allowed ip addresses --
    allow 10.13.248.0/24;
    allow 192.168.254.0/24;

    deny all;

    auth_basic "Restricted";
    auth_basic_user_file /etc/nginx/.htpasswd-devel;

    include snippets/my-fastcgi-php.conf;
    fastcgi_intercept_errors on;
    access_log /var/log/nginx/postdata-php.log postdata;
    #fastcgi_pass unix:/run/php/php-fpm.sock;
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
    fastcgi_param REMOTE_ADDR $cliaddr;
  }

User avatar
aimeos
Administrator
Posts: 7895
Joined: 01 Jan 1970, 00:00

Re: Losing session at basket modification

Post by aimeos » 18 Oct 2023, 07:17

Seems like you've lost your cookies
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

User avatar
Wall0fDeath
Posts: 28
Joined: 30 Aug 2022, 13:56

Re: Losing session at basket modification

Post by Wall0fDeath » 28 Nov 2023, 13:25

Thank you for your answer!

The problem was the following:

I added session creation for api midlewares to be able to use the jsonadm calls. (bc. of the csrf protection)
That made some problems in the force...

So i added the same routes with different middlewares and different names, so they can live peacefully next to each other now. :))

Post Reply