Folks,
I am running WooCommerce 2.0.14 on WordPress 3.9.1. Haven’t upgraded to WooCommerce 2.1 due to theme incompatibility. The setup was pretty much verbatim to the guides here. It’s not MultiSite setup, by the way, and the site is on www.projectartshack.com.
The issue I’m facing now is with session collision (at least, that’s what I think). When two or more people on same IP range add items to the cart as a guest, the other people will also see the items in their cart. Beforehand, I tested my whole setup with people from different parts of the world so the problem wasn’t obvious. Now that I am testing with people using same ISP, that problem arises.
Here is my nginx config for the site:
server {
server_name projectartshack.com;
return 301 $scheme://www.projectartshack.com$request_uri;
}
server {
server_name www.projectartshack.com;
access_log /var/log/nginx/projectartshack.com.access.log;
error_log /var/log/nginx/projectartshack.com.error.log;
root /var/www/projectartshack.com/htdocs;
index index.php;
set $skip_cache 0;
# POST requests and urls with a query string should always go to PHP
if ($request_method = POST) {
set $skip_cache 1;
}
if ($query_string != "") {
set $skip_cache 1;
}
#Skip cache when WooCommerce cart is not empty
if ( $cookie_woocommerce_items_in_cart != "0" ) {
set $skip_cache 1;
}
# Don't cache uris containing the following segments
if ($request_uri ~* "/browse-art.*|/artworks.*|/cart.*|/my-account.*|/checkout.*|/addons.*|/wp-admin/|/xmlrpc.php|wp-.*.php|/feed/|index.php|sitemap($
set $skip_cache 1;
}
# 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;
}
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ .php$ {
try_files $uri /index.php;
include fastcgi_params;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_cache_bypass $skip_cache;
fastcgi_no_cache $skip_cache;
fastcgi_cache NGINXCACHE;
fastcgi_cache_valid 60m;
}
location ~ \.php$ {
set $rt_session "";
if ($http_cookie ~* "wc_session_cookie_[^=]*=([^%]+)%7C") {
set $rt_session wc_session_cookie_$1;
}
if ($skip_cache = 0 ) {
more_clear_headers "Set-Cookie*";
set $rt_session "";
}
fastcgi_cache_key "$scheme$request_method$host$request_uri$rt_session";
try_files $uri =404;
}
location ~ /purge(/.*) {
fastcgi_cache_purge NGINXCACHE "$scheme$request_method$host$1";
}
location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
access_log off; log_not_found off; expires max;
}
location = /robots.txt { access_log off; log_not_found off; }
location ~ /\. { deny all; access_log off; log_not_found off; }
rewrite ^/sitemap_index\.xml$ /index.php?sitemap=1 last;
rewrite ^/([^/]+?)-sitemap([0-9]+)?\.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;
}
So what gives? How do I solve this out, guys?
Cheers
– Sam