Comments (5)
@mbtamuli When in doubt, you can just swap the order of the --add-module=PATH
option of your ./configure
command line when building your nginx or openresty (or changing the add_module
directives' order in your nginx.conf
if you are using dynamic modules).
from srcache-nginx-module.
I have the same issue when debugging Redis Cache at Nginx Level by using srcache module.
The document about this cache status was fully written at here. It only STORE the HTTP 200, 301, and 302 result by default..
I write this comment just for reference, to help anybody go after me understand that this is not a problem.
Cited from the above link
srcache_store_statuses
syntax: srcache_store_statuses <status1> <status2> ..
default: srcache_store_statuses 200 301 302
context: http, server, location, location if
phase: output-header-filter
This directive controls what responses to store to the cache according to their status code.
By default, only 200, 301, and 302 responses will be stored to cache and any other responses will skip srcache_store.
You can specify arbitrary positive numbers for the response status code that you'd like to cache, even including error code like 404 and 503. For example:
srcache_store_statuses 200 201 301 302 404 503;
At least one argument should be given to this directive.
This directive was first introduced in the v0.13rc2 release.
from srcache-nginx-module.
@nhanledev You are correct in that by default only responses with 200, 301 and 302 status code will be stored.
This directive controls what responses to store to the cache according to their status code.
But my whole question was regarding this variable getting wrong value after the response has been stored.
srcache_store_status
The $srcache_fetch_status is correctly populated with MISS or HIT. But $srcache_store_status always reports BYPASS.
This srcache_store_status variable should showSTORE
on the request getting correctly stored.
from srcache-nginx-module.
@mbtamuli It sounds like you are reading the $srcache_store_status
variable value too early, that is, before the srcache_store's output filter is run. Check the relative running order between your srcache's output filter and the ngx_headers_more module's output filter. It seems that you get the order wrong.
from srcache-nginx-module.
@agentzh Okay. I have already attached my configuration above.
srcache_store PUT /redis-store key=$escaped_key;
more_set_headers 'X-SRCache-Fetch-Status $srcache_fetch_status' 'X-SRCache-Store-Status $srcache_store_status';
I believed this order mattered. Can you help me to understand how to
Check the relative running order between your srcache's output filter and the ngx_headers_more module's output filter
In the log(that I attached in the first comment), I found
2018/08/29 04:58:43 [debug] 9#9: *1 http fastcgi parser: 1
2018/08/29 04:58:43 [debug] 9#9: *1 http fastcgi header done
2018/08/29 04:58:43 [debug] 9#9: *1 headers more header filter, uri "/index.php"
2018/08/29 04:58:43 [debug] 9#9: *1 http script var: "MISS"
2018/08/29 04:58:43 [debug] 9#9: *1 http script copy: "<wierd character>"
2018/08/29 04:58:43 [debug] 9#9: *1 http script var: "BYPASS"
2018/08/29 04:58:43 [debug] 9#9: *1 http script copy: "<wierd character>"
2018/08/29 04:58:43 [debug] 9#9: *1 http script var: "0"
2018/08/29 04:58:43 [debug] 9#9: *1 srcache_store decides to store the response
2018/08/29 04:58:43 [debug] 9#9: *1 posix_memalign: 0000555B8CAFDAE0:4096 @16
2018/08/29 04:58:43 [debug] 9#9: *1 srcache store header HTTP/1.1 200 OK
There was a character here that could not be copied.
Are you talking about this? The fact that
headers more header filter, uri "/index.php"
ran before srcache store header HTTP/1.1 200 OK
?
How can I modify my config to fix that?
from srcache-nginx-module.
Related Issues (20)
- can't use srcache_store twice in the same location block HOT 3
- Directives srcache_store_pass_header didn't work HOT 2
- srcache_store_min_size option missing
- srcache_fetch_skip doesn't follow the value changed by access_by_lua HOT 3
- X-Cached header does not appear in the response for 404 status code
- Conflict with multiple currency plugin HOT 8
- Test cases failing on rhel 7.6 ppc64le - Errors host not found in upstream "agentzh.org" HOT 3
- skip caching basic auth HOT 4
- Reverse proxy with caching is not working.
- srcache_store response hangs with request body when used with ngx.req.get_body_data()
- Always get fetch MISS and store BYPASS when using proxy_pass HOT 1
- ngx.redirect 307 makes srcache_fetch fail HOT 3
- [help]About whether a subrequest can be nonblocked
- How to cache terabytes of data HOT 1
- Subrequest to /redis-store failing - rc=403
- How to measure cache hits/misses
- Nginx 1.23.0 header changes
- "srcache_default_expire" directive invalid value" in when using "ms" (milliseconds)
- In function ‘ngx_http_srcache_response_no_cache’ HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from srcache-nginx-module.