Git Product home page Git Product logo

Comments (5)

agentzh avatar agentzh commented on August 27, 2024 1

@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.

nhanledev avatar nhanledev commented on August 27, 2024

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.

mbtamuli avatar mbtamuli commented on August 27, 2024

@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 show STORE on the request getting correctly stored.

from srcache-nginx-module.

agentzh avatar agentzh commented on August 27, 2024

@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.

mbtamuli avatar mbtamuli commented on August 27, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.