Lambda@Edge custom 'Server-Timing' missing

0

I have a Lambda@Edge on origin-request and it returns a Server-Timing header, however the value is ignored or missing.

According to the Cloudfront documentation on Server-Timing header metrics:

"The response that CloudFront sends to the viewer contains a single Server-Timing header that includes the value that came from the origin and the metrics that CloudFront added." (emphasis mine)

I also don't see any documentation saying Lambda@Edge it's not allowed to return a Server-Timing header.

Here are the steps I tried:

  • Setting the response header policy with a "Custom headers" set to Server-Timing and override false, the value is always missing.
  • Setting the response header with "Server-Timing header" enabled returns only Cloudfront metrics and ignores my custom Lambda@Edge response.

Looks like a bug or missing documentation, thank you in advance!

profile picture
asked 2 years ago340 views
1 Answer
0

Is your Lambda function generating and returning the whole response? If it is passing the request through to an origin, I think you'd need to add server-timing on the Origin Response trigger, rather than Origin Request. Either way, the server-timing header generated by your Lambda@Edge function or the Origin will only be sent to the user in the event of a cache miss. If your requests are being served from cache, the value generated by the origin or Lambda@Edge for server-timing will not be present.

AWS
EXPERT
Paul_L
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions