kong version: 1.3.0
this is my config:
log_format main '{"remote":"$remote_addr","user":"$remote_user","agent":"$http_user_agent","code":"$status","host":"$host","hostname":"$hostname","method":"$request_method","path":"$request_uri","port":"$remote_port","protocol":"$server_protocol","x_forwarded_for":"$http_x_forwarded_for","referer":"$http_referer","remote":"$remote_addr","request_length":"$request_length","request_time":$request_time,"scheme":"$scheme","server_addr":"$server_addr","x-cache-status":"$upstream_http_x_cache_status",}';
i use kong plugin: proxy-cache, and it add response header "x_cache_status" ,i want to log it, but I cannot get it from $upstream_http_x_cache_status
, how to do , please help
1.3.0 or 2.1.0)$ kong start --vv)<KONG_PREFIX>/logs/error.log)
$upstream_http_cache_status neither
Hello,
The X-Cache-Status is generated by the proxy-cache plugin directly, therefore it is not found in any upstream returned headers.
Give $sent_http_ x_cache_status a try, it should work. (not tested)
See: https://nginx.org/en/docs/http/ngx_http_core_module.html#var_sent_http_
Hello,
The
X-Cache-Statusis generated by the proxy-cache plugin directly, therefore it is not found in anyupstreamreturned headers.Give
$sent_http_ x_cache_statusa try, it should work. (not tested)See: https://nginx.org/en/docs/http/ngx_http_core_module.html#var_sent_http_
thanks a lot!
solved
Most helpful comment
Hello,
The
X-Cache-Statusis generated by the proxy-cache plugin directly, therefore it is not found in anyupstreamreturned headers.Give
$sent_http_ x_cache_statusa try, it should work. (not tested)See: https://nginx.org/en/docs/http/ngx_http_core_module.html#var_sent_http_