Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CDK: Allow to whitelist headers #2325

Merged
merged 1 commit into from Jan 31, 2022
Merged

Conversation

Negan1911
Copy link
Contributor

Hello, first of all thanks for this great library, and thanks for porting it to CDK.

Currently, I'm working on a Cloudfront app that has the domain as *.mypage.com

Where * is a brand selected by our customers, identifying it has become difficult for a couple of reasons:

  • I don't know how to access the original event sent to the lambda (I also don't know how I can implement this one) so I went to the 2nd option which is reading the Host header.
  • When reading the Host header on SSR, it works quite well, except when the request is to _next/data, in that case, the Host header is from CloudFront because it's not being forwarded, this PR adds the ability to forward headers.

I've tried to keep it up with what was needed, it was being tested by my end and I added a unit test, please let me know if I'm missing something, also, if you have some clues on how to read the original event on nextjs getServerSideProps. I would love to implement that on another PR.

Again, thank you!

@slsnextbot
Copy link
Collaborator

Handler Size Report

No changes to handler sizes.

Base Handler Sizes (kB) (commit 9facd15)

{
    "Lambda": {
        "Default Lambda": {
            "Standard": 1524,
            "Minified": 668
        },
        "Image Lambda": {
            "Standard": 1488,
            "Minified": 800
        }
    },
    "Lambda@Edge": {
        "Default Lambda": {
            "Standard": 1534,
            "Minified": 673
        },
        "Default Lambda V2": {
            "Standard": 1526,
            "Minified": 670
        },
        "API Lambda": {
            "Standard": 634,
            "Minified": 318
        },
        "Image Lambda": {
            "Standard": 1496,
            "Minified": 805
        },
        "Regeneration Lambda": {
            "Standard": 1187,
            "Minified": 546
        },
        "Regeneration Lambda V2": {
            "Standard": 1253,
            "Minified": 573
        }
    }
}

New Handler Sizes (kB) (commit 803efb7)

{
    "Lambda": {
        "Default Lambda": {
            "Standard": 1524,
            "Minified": 668
        },
        "Image Lambda": {
            "Standard": 1488,
            "Minified": 800
        }
    },
    "Lambda@Edge": {
        "Default Lambda": {
            "Standard": 1534,
            "Minified": 673
        },
        "Default Lambda V2": {
            "Standard": 1526,
            "Minified": 670
        },
        "API Lambda": {
            "Standard": 634,
            "Minified": 318
        },
        "Image Lambda": {
            "Standard": 1496,
            "Minified": 805
        },
        "Regeneration Lambda": {
            "Standard": 1187,
            "Minified": 546
        },
        "Regeneration Lambda V2": {
            "Standard": 1253,
            "Minified": 573
        }
    }
}

@codecov
Copy link

codecov bot commented Jan 31, 2022

Codecov Report

Merging #2325 (803efb7) into master (9facd15) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2325      +/-   ##
==========================================
+ Coverage   83.63%   83.65%   +0.01%     
==========================================
  Files         104      104              
  Lines        3716     3719       +3     
  Branches     1194     1197       +3     
==========================================
+ Hits         3108     3111       +3     
  Misses        596      596              
  Partials       12       12              
Impacted Files Coverage Δ
...rless-components/nextjs-cdk-construct/src/index.ts 93.57% <100.00%> (+0.18%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9facd15...803efb7. Read the comment docs.

Copy link
Collaborator

@dphang dphang left a comment

Choose a reason for hiding this comment

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

Thanks, it LGTM

@dphang dphang merged commit b975aed into serverless-nextjs:master Jan 31, 2022
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.

None yet

3 participants