[Solved] Unable to add correct Report-to header

1. Caddy version (caddy version):

v2.2.1 h1:Q62GWHMtztnvyRU+KPOpw6fNfeCD3SkwH7SfT1Tgt2c=

2. How I run Caddy:

/usr/local/bin/caddy run --config /usr/local/etc/caddy/Caddyfile

a. System environment:

FreeBSD 12.2

b. Command:

service caddy start

d. My complete Caddyfile or JSON config:

Report-To    "\{\"max_age\": 86400,\"endpoints\": [\{\"url\": \"https://private.uriports.com/reports\"\}],\"include_subdomains\": true\}"

3. The problem I’m having:

Report-to header is not sent correctly; header sent to client is

],“include_subdomains”: true}

4. Error messages and/or full log output:

5. What I already tried:

Validated JSON, escaped with different methods based on this: Unable to set header containing JSON in Caddy v2 b15 · Issue #3116 · caddyserver/caddy · GitHub

6. Links to relevant resources:

Finally fixed it by double-escaping the placeholders.

2 Likes

You can also use backticks instead of double quotes for the string, to avoid needing to escape the double quotes. I think this should work:

Report-To `\{"max_age": 86400,"endpoints": [\{"url": "https://private.uriports.com/reports"}],"include_subdomains": true}`
1 Like

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