openresty / openresty/srcache-nginx-module

Directives srcache_store_pass_header didn't work

Open
#72 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
486
Forks
101
Avg merge
1h 28m
Merged PRs (30d)
2

Description

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;

srcache_store_pass_header Connection;
srcache_store_pass_header Set-Cookie;
srcache_store_pass_header Keep-Alive;
srcache_store_pass_header Proxy-Authenticate;
srcache_store_pass_header Proxy-Authorization;
srcache_store_pass_header TE;
srcache_store_pass_header Trailers;
srcache_store_pass_header Transfer-Encoding;
srcache_store_pass_header Upgrade;

add_header X-Cached $srcache_fetch_status;
proxy_pass http://web_servers;

}

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?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with README.markdown and the srcache_store_pass_header behavior described in the issue, then reproduce the configuration using curl and inspect the memcached result with telnet. Trace why the shown headers do not allow storage; done means the second request is served from cache and the expected entry is present in memcached.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, memcached, nginx
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.