Score:0

How to send nginx cache key as a header?

ps flag

I would like to send an NGINX cache key to a client. Instead of applying MD5 to "$scheme$proxy_host$request_uri" as described in the documentation (see http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_cache_key and http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_cache_path), I prefer to obtain the cache key from the file name.

Let's assume I have the same proxy_cache_path as mentioned in the documentation:

proxy_cache_path /data/nginx/cache levels=1:2 keys_zone=one:10m;

and the files structure is the same too: /data/nginx/cache/c/29/b7f54b2df7773722d382f4809d65029c

Question: How can I extract the b7f54b2df7773722d382f4809d65029c (or whatever key will be) from my *.conf?

I have considered integrating a C script to obtain the filename. Will this approach work, and is it a suitable solution to the problem?

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.