I want to send custom response headers on my distribution related to reporting; so, I created a custom response headers policy in Cloudfront Console.
The values of that headers are in json format. In the console looks fine, but the responses are bad:
curl -I https://inngresa.com
HTTP/2 200
content-type: text/html; charset=utf-8
content-length: 23265
date: Thu, 11 Nov 2021 14:39:39 GMT
last-modified: Tue, 04 May 2021 23:24:24 GMT
etag: "ed20666c9059ac7707fb2065e9473ffe"
content-encoding: gzip
accept-ranges: bytes
server: AmazonS3
x-xss-protection: 1; mode=block
x-frame-options: DENY
strict-transport-security: max-age=31536000; preload
nel: {"report_to":"default"%2c"max_age":2592000%2c"include_subdomains":true%2c"failure_fraction":1.0}
report-to: {"group":"default"%2c"max_age":10886400%2c"endpoints":\[{"url":"https://aaaaaaa.uriports.com/reports"}]%2c"include_subdomains":true}
reporting-endpoints: default="https://aaaaaaa.uriports.com/reports"
x-cache: Miss from cloudfront
via: 1.1 c07bfe3e13ab3d2465e47a18f1dbb562.cloudfront.net (CloudFront)
x-amz-cf-pop: SCL50-C1
x-amz-cf-id: c-OtlVYpKgL-UOChqBJUMZ6v0wrdPxH4wB_5hgjNMjXluV7-eIlDzg==
the NEL header converts the comma to %2c, obviously it is url encoded; but the header needs to be a valid json.