Open ricardo-ml opened 6 years ago
i tested by nginx 1.14.0. it have same problem This is debug log: 2018/07/03 14:27:37 [debug] 8877#0: 4 http upstream request: "/a.html?" 2018/07/03 14:27:37 [debug] 8877#0: 4 http upstream process header 2018/07/03 14:27:37 [debug] 8877#0: 4 malloc: 0000000000E69480:4096 2018/07/03 14:27:37 [debug] 8877#0: 4 recv: eof:1, avail:1 2018/07/03 14:27:37 [debug] 8877#0: 4 recv: fd:11 260 of 4096 2018/07/03 14:27:37 [debug] 8877#0: 4 http proxy status 200 "200 OK" 2018/07/03 14:27:37 [debug] 8877#0: 4 http proxy header: "Date: Tue, 03 Jul 2018 06:27:36 GMT" 2018/07/03 14:27:37 [debug] 8877#0: 4 http proxy header: "Server: Apache/2.4.6 (CentOS)" 2018/07/03 14:27:37 [debug] 8877#0: 4 http proxy header: "Last-Modified: Wed, 27 Jun 2018 07:08:38 GMT" 2018/07/03 14:27:37 [debug] 8877#0: 4 http proxy header: "ETag: "2a-56f9a48ab6919"" 2018/07/03 14:27:37 [debug] 8877#0: 4 http proxy header: "Accept-Ranges: bytes" 2018/07/03 14:27:37 [debug] 8877#0: 4 http proxy header: "Content-Length: 42" 2018/07/03 14:27:37 [debug] 8877#0: 4 http proxy header: "Connection: close" 2018/07/03 14:27:37 [debug] 8877#0: 4 http proxy header: "Content-Type: text/html; charset=UTF-8" 2018/07/03 14:27:37 [debug] 8877#0: 4 http proxy header done -->2018/07/03 14:27:37 [debug] 8877#0: 4 srcache_store skipped due to request method HEAD<-- 2018/07/03 14:27:37 [debug] 8877#0: 4 http script var: "MISS" 2018/07/03 14:27:37 [debug] 8877#0: 4 HTTP/1.1 200 OK Server: nginx/1.14.0 Date: Tue, 03 Jul 2018 06:27:37 GMT Content-Type: text/html; charset=UTF-8 Content-Length: 42 Connection: keep-alive Last-Modified: Wed, 27 Jun 2018 07:08:38 GMT ETag: "2a-56f9a48ab6919" Accept-Ranges: bytes X-Cached: MISS
Note that since the v0.17 release HEAD requests are always skipped by srcache_store because their responses never carry a response body.
https://github.com/openresty/srcache-nginx-module#srcache_methods
I believe the MISS is because you're using curl -I
,
HI, I use srcache-nginx with memcached. i read your "README.markdown" then i know by defult command "srcache_store PUT /memc $key" can't store if http header have "Connection:keepalive" . so i add command "srcache_store_pass_header" to force store, but it isn't work.
My nginx.conf: location = /memc { internal; set $memc_key $query_string; set $memc_exptime 600; memc_pass 127.0.0.1:11211; }
location / { set $my_key $request_uri; srcache_fetch GET /memc $my_key; srcache_store PUT /memc $my_key; srcache_methods GET HEAD POST;
}
Test Result( I already exec twice ): [root@test ~]#curl -I http://192.168.0.214/a.html HTTP/1.1 200 OK Server: Nginx/1.8.1 Date: Tue, 03 Jul 2018 02:35:10 GMT Content-Type: text/html; charset=UTF-8 Content-Length: 42 Connection: keep-alive Last-Modified: Wed, 27 Jun 2018 07:08:38 GMT ETag: "2a-56f9a48ab6919" Accept-Ranges: bytes X-Cached: MISS
Memcached Result: [root@test ~]#telnet 127.0.0.1 11211 get /a.html END
Can you help me to fix this problem?