来自shopify代理的缓存请求

时间:2017-08-17 08:07:12

标签: caching nginx shopify fastcgi

我想从shopify App代理缓存请求。这是我尝试的:

  • 启用了fastcgi的Nginx
  • 直接访问我们网站的请求已成功缓存(HIT状态)
  • 通过Shopify App代理的请求始终失败(MISS状态)

我的配置:

nginx.conf

fastcgi_cache_path  /dev/shm/nginx levels=1:2 keys_zone=dev:200m inactive=60m max_size=500m;
fastcgi_cache_key "$scheme$request_method$host$request_uri";
fastcgi_cache_use_stale updating error timeout invalid_header http_500;
fastcgi_ignore_headers Cache-Control Expires Set-Cookie X-Accel-Expires ;

vhost.conf

location ~ \.php$ {
    try_files $uri /index.php =404;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_pass            unix:/home/xxx.abc/php-fpm.sock;
    fastcgi_index           index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
    fastcgi_cache dev;
    fastcgi_ignore_headers Cache-Control Expires Set-Cookie Vary X-Accel-Expires;
    proxy_hide_header "Set-Cookie";
    fastcgi_cache_valid 36h;
}

直接向我们的服务器请求时的access.log

xxx.xxx.xxx.xxx - HIT [17/Aug/2017:15:02:17 +0700]  "GET /comment/get_review?product_id=10461149960&shop_id=17224077&currentPage=4&shop=xxx.myshopify.com&path_prefix=%2Fa%2Fcomment&timestamp=1502955999&signature=89b33dcecfe1f418f038b5a671f5781332afa8d7c0c9a8a104db8929be10f015 HTTP/2.0" 200 1676 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36"

通过Shopify的App代理请求时访问.log

23.227.37.119 - MISS [17/Aug/2017:15:04:09 +0700]  "GET /comment/get_review?product_id=10461149768&shop_id=17224077&shop=quanstore1.myshopify.com&path_prefix=%2Fa%2Fcomment&timestamp=1502957049&signature=815b7ebf67e8a621c3057a53bd1dcd6d6a719a4cd43e4b0140855036066e0d18 HTTP/1.0" 200 8177 "https://quanstore1.myshopify.com/products/led-pet-safety-collar" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36"

我不明白这里发生了什么。请帮我。非常感谢

PS:抱歉我的英文不好。

0 个答案:

没有答案