Prestashop: PS 1.7.2.4 TOO MANY REDIRECT ON LOGIN (but login state work after refresh)

Created on 30 Oct 2018  路  19Comments  路  Source: PrestaShop/PrestaShop

Describe the bug
Try to login from frontend result in "too many redirect error". Hard refresh the page to the site root result in correct login state.

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'store.sixrace.it'
  2. try login
  3. see error too many redirect on store.sixrace.it/it/account
  4. point browser to store.sixrace.it and force refresh
  5. find your user logged in

[email protected]
12345678

Additionnal information
INFORMAZIONI DI CONFIGURAZIONE
Queste informazioni devono essere indicate quando segnali un problema sul nostro bug tracker o sul forum.

INFORMAZIONI SUL SERVER
Informazioni sul server: Linux #163-Ubuntu SMP Mon Sep 24 13:14:43 UTC 2018 x86_64

Versione software del server: Apache/2.4.33 (Ubuntu)

Versione di PHP: 7.0.32-2+ubuntu16.04.1+deb.sury.org+1

Limite di memoria: 4G

Tempo di esecuzione massimo: 6000

Dimensione Max. dei file da caricare: 200M

Modulo PageSpeed per Apache installato (mod_instaweb)

INFORMAZIONI DATATBASE
Versione MySQL: 5.7.21-20

Server MySQL: 127.0.0.1

Nome MySQL: Prestashop_1

Utente MySQL: prestashop

Prefisso delle tabelle: ps_

Motore MySQL: InnoDB

Driver MySQL: DbPDO

INFORMAZIONI DEL NEGOZIO
Versione di PrestaShop: 1.7.2.4

URL negozio:

Tema attualmente utilizzato: classic

1.7.2.4 Bug FO No change required

Most helpful comment

Any update? Good (and usable) support for NGINX is a good goal for PS

All 19 comments

Update: the problem is related to the "My account" section. After login you ever get too many redirect loop try to access this page.

I've se the "redirect customer to shop cart after login" option to YES (to avoid impossibility for customer to use our store today), but this is ignored by prestashop that still redirect to https://store.sixrace.it/it/login?back=my-account

Hi @matteolavaggi,

Could you please provide us with more info? We need more details to understand how we can reproduce your issue:

  • host
  • debug mode report
  • PHP error logs
  • apache error log
  • javascript console log
  • screenshots

Don't you know how to get this information? Please read the following article:
http://build.prestashop.com/howtos/misc/how-to-create-bug-report/

Thanks!

Thanks, there is no console output and no apache / nginx error. Only see a lot of GET

9h6m35s000xOct 30 16:26:57 vw03 nginx: [185.93.230.20] [store.sixrace.it] [30/Oct/2018:16:26:57 +0100] [Cache:-] "GET /it/login?back=my-account HTTP/1.1" 3x
  9h6m35s000xOct 30 16:26:57 vw03 apache[31488]: 127.0.0.1 store.sixrace.it - - [30/Oct/2018:16:26:57 +0100] "GET /it/login?back=my-account HTTP/1.1" 302 - "x
  9h6m36s000xOct 30 16:26:58 vw03 nginx: [185.93.230.20] [store.sixrace.it] [30/Oct/2018:16:26:58 +0100] [Cache:-] "GET /it/login?back=my-account HTTP/1.1" 3x
  9h6m36s000xOct 30 16:26:58 vw03 apache[31488]: 127.0.0.1 store.sixrace.it - - [30/Oct/2018:16:26:58 +0100] "GET /it/login?back=my-account HTTP/1.1" 302 - "x
  9h6m36s000xOct 30 16:26:58 vw03 nginx: [185.93.230.20] [store.sixrace.it] [30/Oct/2018:16:26:58 +0100] [Cache:-] "GET /it/login?back=my-account HTTP/1.1" 3x
  9h6m36s000xOct 30 16:26:58 vw03 nginx: [185.93.230.20] [store.sixrace.it] [30/Oct/2018:16:26:58 +0100] [Cache:-] "GET /it/login?back=my-account HTTP/1.1" 3x
  9h6m36s000xOct 30 16:26:58 vw03 nginx: [185.93.230.20] [store.sixrace.it] [30/Oct/2018:16:26:58 +0100] [Cache:-] "GET /it/login?back=my-account HTTP/1.1" 3x
  9h6m36s000xOct 30 16:26:58 vw03 nginx: [185.93.230.20] [store.sixrace.it] [30/Oct/2018:16:26:58 +0100] [Cache:-] "GET /it/login?back=my-account HTTP/1.1" 

Screenshoot only can show the "too many redirect error"

redirect is from account to login?back=my_account.

https://store.sixrace.it/it/login?back=my-account

GET /it/login?back=my-account HTTP/1.1
Host: store.sixrace.it
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache
Upgrade-Insecure-Requests: 1
DNT: 1
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
Accept-Encoding: gzip, deflate, br
Accept-Language: it-IT,it;q=0.9,en-US;q=0.8,en;q=0.7
Cookie: PHPSESSID=9771sdlnpja9cjph9ak26r3d12; _ga=GA1.2.2018682385.1540909326; _gid=GA1.2.1919940386.1540909326; _fbp=fb.1.1540909325638.1308184950; PrestaShop-48963f8658cfe6a7bfb0f4330e52d2c2=def50200516b87efca6d5b565d59619f2847f58db0e985ad5bfdef8dfc2fe7c92a84c6ab92c48dcd77f72cba0367827adc85bf69dfcd82655b2b62d106a5d0adc195937df0e4228a98b5071ce5089036516941ccad6c8acbd369135fcd52d31a916674e935487e1da2d9c4a2a80948d6f4758dcff52dea41684a1c3cf4766043e1069096a81da4bf8ae48dccdf494d382f678a4879585e97830029378f1831291d66fdcb7ef04460a49daa4f1801276a0558907829e2af5307a53ab81d3ce21d88c5268a72146778cb556cbdef34b5ad26facad7a8af2b71144542c13427559b719e2b6c63fab7a15a2c861fa48658e87e386c9865988174b782a9f371da8414c7d2724b42fc58a29d857c05ae3c7d144b4e9ecf5f7824008cb1a78e5ae0c3467ba874a55fcb996c17afe4b813942f4fe69c7afe3fda8fdb5753a06d690f6081beabc95f82e8b262d91a9c73d9583a28be6cc5a92d0484c9559edb2540aa2138af65d53a246bf7dfc73da88b28c3; _gat=1; PrestaShop-9829b1065753fd5cf3a8a467c7c90dec=def502009cf0ce5dda9cdee03b3e3367fa3ee40aef8720d2075c954cf2fa97ae5a39c352154fe8607480901ecab832f84072a0b6f5dde0cc6fa745e555450723f2b33548a315521bc2120783c2e845867f712661c7417a61e0c79f5c4cf09c054d20792a67da516756531d20c6e1807d54757f2a304c2e69ff743045c60a7c38e64723457700b5956765408561ee7c9029cf2a1806952625f0a3a802a948d00edc992a7e23a5a0e90ed4010a69415c22f58187d9290940967847f7185cf4055d235377351f0faedc0839946342399d9e80036bb878eddd896dd2de0609a6bc2536ba01cf2b597f7b779effdd431dae9b672b19ff96488c12ec42f79bb128c738efaf3c2cb2f6418903e3f9f8532fa03ad65ee3b910916073bcec4500dda25600aab22c19bca9149b7aaaed24e684f39dc22b0da0abf211c2bf8c91713ba10fcd6d58c62b93c52e33e722023d2d2640db6660e65181e041cf437c161ed0aa457485b84c7f7944be01035dbf627c4cd1e549e5743221666e5bfb64a9f6d14c
HTTP/1.1 302 Found
Server: Sucuri/Cloudproxy
Date: Tue, 30 Oct 2018 15:26:51 GMT
Content-Type: text/html; charset=utf-8
Content-Length: 0
Connection: keep-alive
X-Sucuri-ID: 15020
X-XSS-Protection: 1; mode=block
X-Frame-Options: SAMEORIGIN
X-Content-Type-Options: nosniff
Content-Security-Policy: upgrade-insecure-requests;
Location: https://store.sixrace.it/it/account
Strict-Transport-Security: max-age=3600; includeSubDomains
X-GG-Cache-Date: Tue, 30 Oct 2018 15:26:51 GMT
X-Sucuri-Cache: BYPASS

https://store.sixrace.it/it/account

GET /it/account HTTP/1.1
Host: store.sixrace.it
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache
Upgrade-Insecure-Requests: 1
DNT: 1
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
Accept-Encoding: gzip, deflate, br
Accept-Language: it-IT,it;q=0.9,en-US;q=0.8,en;q=0.7
Cookie: PHPSESSID=9771sdlnpja9cjph9ak26r3d12; _ga=GA1.2.2018682385.1540909326; _gid=GA1.2.1919940386.1540909326; _fbp=fb.1.1540909325638.1308184950; PrestaShop-48963f8658cfe6a7bfb0f4330e52d2c2=def50200516b87efca6d5b565d59619f2847f58db0e985ad5bfdef8dfc2fe7c92a84c6ab92c48dcd77f72cba0367827adc85bf69dfcd82655b2b62d106a5d0adc195937df0e4228a98b5071ce5089036516941ccad6c8acbd369135fcd52d31a916674e935487e1da2d9c4a2a80948d6f4758dcff52dea41684a1c3cf4766043e1069096a81da4bf8ae48dccdf494d382f678a4879585e97830029378f1831291d66fdcb7ef04460a49daa4f1801276a0558907829e2af5307a53ab81d3ce21d88c5268a72146778cb556cbdef34b5ad26facad7a8af2b71144542c13427559b719e2b6c63fab7a15a2c861fa48658e87e386c9865988174b782a9f371da8414c7d2724b42fc58a29d857c05ae3c7d144b4e9ecf5f7824008cb1a78e5ae0c3467ba874a55fcb996c17afe4b813942f4fe69c7afe3fda8fdb5753a06d690f6081beabc95f82e8b262d91a9c73d9583a28be6cc5a92d0484c9559edb2540aa2138af65d53a246bf7dfc73da88b28c3; _gat=1; PrestaShop-9829b1065753fd5cf3a8a467c7c90dec=def502009cf0ce5dda9cdee03b3e3367fa3ee40aef8720d2075c954cf2fa97ae5a39c352154fe8607480901ecab832f84072a0b6f5dde0cc6fa745e555450723f2b33548a315521bc2120783c2e845867f712661c7417a61e0c79f5c4cf09c054d20792a67da516756531d20c6e1807d54757f2a304c2e69ff743045c60a7c38e64723457700b5956765408561ee7c9029cf2a1806952625f0a3a802a948d00edc992a7e23a5a0e90ed4010a69415c22f58187d9290940967847f7185cf4055d235377351f0faedc0839946342399d9e80036bb878eddd896dd2de0609a6bc2536ba01cf2b597f7b779effdd431dae9b672b19ff96488c12ec42f79bb128c738efaf3c2cb2f6418903e3f9f8532fa03ad65ee3b910916073bcec4500dda25600aab22c19bca9149b7aaaed24e684f39dc22b0da0abf211c2bf8c91713ba10fcd6d58c62b93c52e33e722023d2d2640db6660e65181e041cf437c161ed0aa457485b84c7f7944be01035dbf627c4cd1e549e5743221666e5bfb64a9f6d14c

HTTP/1.1 302 Found
Server: Sucuri/Cloudproxy
Date: Tue, 30 Oct 2018 15:26:51 GMT
Content-Type: text/html; charset=utf-8
Content-Length: 0
Connection: keep-alive
X-Sucuri-ID: 15020
X-XSS-Protection: 1; mode=block
X-Frame-Options: SAMEORIGIN
X-Content-Type-Options: nosniff
Content-Security-Policy: upgrade-insecure-requests;
Location: https://store.sixrace.it/it/login?back=my-account
Strict-Transport-Security: max-age=3600; includeSubDomains
X-GG-Cache-Date: Tue, 30 Oct 2018 15:20:51 GMT
X-Sucuri-Cache: HIT

Hi @matteolavaggi,

If you enable the debug mode, there is no exception displayed?
Thanks!

No on login page no error, after login too many redirect prevent browser from reach the page so there is no error handling.

Is some things related to cookies or url redirect. How to force prestashop redirect new logged in user to some where to make a test? instead that send it to my account page?

This is not a fix as users need to access their login details but can be a step close to diagnose problem

its right that PS set cookie for .store.sixrace.it instead for store.sixrace.it ?

Hi @matteolavaggi,

Since you installed a cache module before & you removed.
Could you please check is there any overrides exists that causes the problem

i've reverted back a snapshot of before install cache module so its 100% not this chace module. But this is a big issue for us. All the page work great expect for the login / logout and account function.
Anyone can inspect in any way?

Update: is something related to NGINX + APACHE setup. There is some expert that can work with me to diagnose? All other works great

Update 2: is something related to every external proxy system like sucuri or nginx in front of apache or sucuri>nginx>apache.

So is something related to bad cache handled by prestashop , i think its fixable with some support.

Hi @matteolavaggi,

Could you please try to disable the Friendly URL in the BO > Shop Parameters > Traffic & SEO, clear cache & check if this issue happens again.
Thanks!

I've just try with friendly url disabled, nothing change. There is some nginx - apache expert in PS team that can collaborate with me to diagnose this ?

i dont use nginx for serving prestashop site.
I use nginx in front of apache so all the rewrite rules was handled by apache . nginx only serve static content, with these setup, and it work amazing fast:

``
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;

-- LOGGING --

log_format  main  '[$remote_addr] [$http_host] [$time_local] [Cache:$upstream_cache_status] "$request" '
                  '$status $body_bytes_sent "$http_referer" '
                  '"$http_user_agent" "$http_x_forwarded_for"'
                  'UPSTREAM rtotT=$request_time uconnT="$upstream_connect_time" uheaderT="$upstream_header_time" urespT="$upstream_response_time"';

#access_log  /var/log/nginx/access.log  main;
access_log syslog:server=10.9.9.122,facility=local7,tag=nginx,severity=warn main;

error_log syslog:server=10.9.9.122,facility=local7,tag=nginx,severity=warn;
#error_log  /var/log/nginx/error.log warn;

-- END LOGGING --

sendfile        on;
tcp_nodelay       on;
keepalive_timeout  65;

-- EXTRA CONFIG FILE --

include /etc/nginx/conf.d/*.conf;

-- END EXTRA CONFIG FILE --

    # set client body size to 50M #
    client_max_body_size 50M;

-- SSL SETTING --

ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
# Optimize session cache
ssl_session_cache shared:SSL:50m;
ssl_session_timeout 1d;
# Enable session tickets
ssl_session_tickets on;
# OCSP Stapling
ssl_stapling on;
ssl_stapling_verify on;
resolver 8.8.8.8 8.8.4.4 208.67.222.222 208.67.220.220 valid=60s;
resolver_timeout 1s;
ssl_dhparam /etc/ssl/certs/dhparam.pem;

-- END SSL SETTINGS --

-- CACHE --

path /mnt/datadisk/var/lib/nginx/cache

proxy_buffering on;

proxy_cache_path /mnt/datadisk/var/lib/nginx/cache levels=1:2 keys_zone=vw03-cache:10m max_size=10G inactive=1m use_temp_path=off;
proxy_cache_methods GET HEAD;
proxy_cache_valid 5m;
proxy_cache_revalidate on;
proxy_cache_lock on;
proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504;

proxy_cache_key $scheme$host$proxy_host$request_uri;

proxy_cache_background_update on;

add_header X-GG-Cache-Status $upstream_cache_status;
add_header X-GG-Cache-Date $upstream_http_date;

open_file_cache max=10000 inactive=5m;
open_file_cache_valid 1m;
open_file_cache_min_uses 1;
open_file_cache_errors on;

-- END CACHE --

proxy_http_version 1.1; # Always upgrade to HTTP/1.1
proxy_set_header Connection ""; # Enable keepalives

Expires map

map $sent_http_content_type $expires {

default off;

text/html epoch;

text/css max;

application/javascript max;

~image/                    90d;

}

-- XXX.IT --

server {
listen 80;
server_name xxx.it;

    # -- REDIRECT HTTP TO HTTPS PER xxx.IT
    return 301 https://xxx.it;

}

server {

    proxy_cache vw03-cache;

    # -- PROXY SETUP PER xxx -- #


    proxy_buffer_size 4k;
    proxy_set_header X-Real-IP  $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto https;
    proxy_set_header Host $host;
    proxy_redirect off;
    proxy_connect_timeout       600;
    proxy_send_timeout          600;
    proxy_read_timeout          600;
    send_timeout                600;

    # -- END PROXY SETUP PER xxx -- #

    expires $expires;

    # -- SSL SEETUP PER HTTPS://xxx-- #

    listen 443 ssl http2;

    root /var/www/htdocs/prestashop;

    index index.php index.html index.htm;

    server_name xxx.it;


    ssl_certificate /etc/nginx/ssl/xxx.crt;
    ssl_certificate_key /etc/nginx/ssl/xxx.key;

    # -- SSL STS PER xxx.iT -- #
    add_header Strict-Transport-Security "max-age=3600; includeSubDomains" always;
    add_header X-GG-Cache-Status $upstream_cache_status;
    add_header X-GG-Cache-Date $upstream_http_date;

    # -- FILE STATICI -- #
    location ~* .(ico|jpg|png|gif|jpeg|css|swf|js|woff|woff2|css)$ {

            #access_log off;
            proxy_ignore_headers Cache-Control;
            proxy_ignore_headers X-Accel-Expires;
            proxy_ignore_headers Expires;
            proxy_cache_valid 200 302 90d;
            proxy_cache_valid 404     10d;
            add_header Pragma public;
            add_header Cache-Control public;
            add_header X-GG-Cache-Status $upstream_cache_status;
            add_header X-GG-Cache-Date $upstream_http_date;
            expires 90d;
            try_files $uri @proxy;
            http2_push_preload on;
    }
    # -- END FILE STATICI -- #

    # -- PROXY LOCATION PER REDIRECT APACHE -- #
    location @proxy {
            http2_push_preload on;
            proxy_pass http://127.0.0.1:8080;
    }
    # -- END PROXY LOCATION PER REDIRECT APACHE -- #

    # -- ROOT -- #
    location / {
            http2_push_preload on;

            try_files $uri $uri/ @proxy;
    }
    # -- END ROOT -- #

    # -- PHP -- #
    location ~ \.php$ {
            http2_push_preload on;
            proxy_pass http://127.0.0.1:8080;
    }
    # -- END PHP -- #

    # -- HTACCESS -- #
    location ~ /\.ht {

            deny all;
    }
    # -- END HTACCESS -- #
    location ^~ /account {
    add_header Cache-Control "no-cache, max-age=1";
    proxy_pass http://127.0.0.1:8080;
    }

}

-- END SITE --

# Gzip Settings
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 32 16k;
gzip_http_version 1.1;
gzip_min_length 250;
gzip_types image/jpeg image/bmp image/svg+xml text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript image/x-icon;

``

Hi @matteolavaggi,

Thanks for your feedback.
Our devs are not available this week but once they come back we'll ask them to have a look at this issue.
ping @PierreRambaud @eternoendless what do think of his issue?
Thanks!

Thanks, i can setup a test enviroment cloning my actual VM if needed.

Any update? Good (and usable) support for NGINX is a good goal for PS

hello have you fixed the issue ?
because i have the same problem

Hi,

I did not manage to reproduce the issue with PS1.7.5.0 (Friendly URL enabled & disabled) & nginx/1.14.0.
You need to check your server configuration as described in this file
https://github.com/PrestaShop/PrestaShop/blob/develop/docs/docker/nginx_fpm/prestashop-nginx/prestashop-nginx.conf
Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

matks picture matks  路  3Comments

khouloudbelguith picture khouloudbelguith  路  3Comments

vincent-dp picture vincent-dp  路  3Comments

PrestaShark picture PrestaShark  路  3Comments

Van-peterson picture Van-peterson  路  3Comments