cloudflare / cloudflare/lua-upstream-cache-nginx-module
the module is unvalid when upstream_cache_status is HIT
- Langage dominant
- C
- Étoiles
- 124
- Forks
- 40
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
hi:
I use the module to set meta info when upstream_cache_status is HIT, but I found this is unvalid.
code:
header_filter_by_lua '
local http_cache = require("http_cache")
local cache_status = (ngx.var.upstream_cache_status or "")
if cache_status == "HIT" and ngx.ctx.flag == "true" then
local cache_data = http_cache.get_metadata()
local new_expire = ngx.time() - 1
if cache_data and cache_data["valid_sec"] then
http_cache.set_metadata({ valid_sec = new_expire,
fcn = { valid_sec = new_expire,
expire = new_expire } })
end
end
';
Can I use it like this? thx!
Guide de contribution
Ouvrir le guide de contribution
Piste de recherche
Start by reproducing the shown header_filter_by_lua configuration with upstream_cache_status set to HIT, then inspect the module's metadata API and its handling of this request phase. Done means establishing whether set_metadata is supported in this situation and documenting or correcting the observed behavior.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- c, lua, nginx
- Domaine
- backend, infrastructure
- Type d'issue
- Bug
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- À l'abandon
- Clarté
- À clarifier
- Accessibilité débutants
- 25/100