Skip to content

Conversation

@Darasimi-Ajewole
Copy link

Fixes #265

@Darasimi-Ajewole Darasimi-Ajewole changed the title Fix intermittent signing error Fix: intermittent signing error Nov 22, 2025
@Darasimi-Ajewole Darasimi-Ajewole changed the title Fix: intermittent signing error fix: intermittent signing error Nov 22, 2025
@revmischa revmischa requested a review from Copilot November 23, 2025 03:44
Copilot finished reviewing on behalf of revmischa November 23, 2025 03:45
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes an intermittent signing error (issue #265) by properly handling volatile headers in AWS SigV4 request signing for Lambda@Edge functions. The root cause was that headers like "via" and "x-forwarded-for" change between network hops, causing signature mismatches.

Key Changes:

  • Modified the signing logic to use unsignableHeaders option instead of manually deleting headers
  • Added a new test to verify that volatile headers are excluded from the signature
  • Improved test setup with proper environment variable lifecycle management

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/lambdas/sign-fn-url.ts Updated signing logic to mark volatile headers as unsignable via the unsignableHeaders option; changed let to const for headerBag variable
src/lambdas/sign-fn-url.test.ts Added test for volatile header exclusion; improved test setup with beforeEach/afterEach for environment variable management

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Intermittent signing error from cloudfront

2 participants