Http timing placeholders are strings, float desired

1. Caddy version (caddy version): v2.4.6

a. System environment:

Ubuntu 20.04.4

b. Command:

./caddy run --config /cms/setupHost/configs/etc/caddy/Caddyfile

c. Service/unit/compose file: N/A

d. My complete Caddyfile or JSON config:

header x-bcms-web-rt {http.request.duration}

reverse_proxy http://127.0.0.1:8000 {
   header_down x-bcms-web-app-rt {http.reverse_proxy.upstream.latency}
}

3. The problem I’m having:

I’m trying to return the placeholders {http.request.duration} and {http.reverse_proxy.upstream.latency} in http headers, but I’d like these to be returned without the time formatting suffix (µs, ns, ms, etc).

Instead of 655.947µs , I would prefer 0.655947 which is millisecond resolution, without the ms string at the end.

I would like this so that my upstream logging doesn’t need to do any conversions, as it appears the special µ character gets mangled by various upstreams, including my CDN provider (Cloudflare).

curl -I http://127.0.0.1/dashboard-dev/
X-Bcms-Web-App-Rt: 655.947µs
X-Bcms-Web-Rt: 65.29µs

That’s a reasonable request. I opened a PR to add _ms variants for the proxy timing placeholders:

2 Likes

This topic was automatically closed after 30 days. New replies are no longer allowed.