Redis + WooCommerce : 502 Bad Gateway



I’m using Redis for my WooCommerce I really like the speed, but I’m getting 502 Bad Gateway when a user logged in the website. I added to my nginx config:

  # Don't use the cache for logged in users or recent commenters                                                      
    if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in") {      
            set $skip_cache 1;                                                                                          
    # Don't cache shopping basket, checkout or account pages                                                            
    if ($request_uri ~* "/cart/*$|/checkout/*$|/my-account/*$") {                                                       
            set $skip_cache 1;                                                                                          

But it’s not working for me, I’m wondering if there is a better configuration for Redis with WooCommerce.

I really appreciate your help.