Allow overriding of lambda@edge origin-request for custom paths
See original GitHub issueIs your feature request related to a problem? Please describe. I have a custom path on my NextJS app that I want to route through a custom Lambda@Edge function of my own, but this code overrides it even if I provide it in the input configuration.
Describe the solution you’d like Allow the override to happen, I don’t think it makes sense to have a configuration that gets overridden always.
Describe alternatives you’ve considered
Since I can’t do this override I have to manually edit the default-lambda
code using a custom script on the build.postBuildCommands
.
Additional context
nextApp:
component: '@sls-next/serverless-component@1.19.0-alpha.30'
inputs:
cloudfront:
/custom-route/*:
viewerProtocolPolicy: 'redirect-to-https'
allowedHttpMethods:
['GET', 'HEAD', 'OPTIONS', 'PUT', 'POST', 'PATCH', 'DELETE']
minTTL: 0
maxTTL: 31536000
defaultTTL: 0
forward:
cookies: 'all'
queryString: true
compress: true
lambda@edge:
origin-request: THIS_GETS_OVERRIDEN_WITH_THE_DEFAULT_LAMBDA_ARN
Issue Analytics
- State:
- Created 3 years ago
- Comments:5
Top Results From Across the Web
Lambda@Edge example functions - Amazon CloudFront
This function demonstrates how an origin-request trigger can be used to change from a custom origin to an Amazon S3 origin from which...
Read more >Request and response behavior for custom origins
This topic contains information about how CloudFront processes viewer requests and forwards the requests to your custom origin.
Read more >How to use CloudFront Functions to change the origin request ...
Unless you want to change the origins, which is not a good solution, you need to fix the origin request path. A Lambda...
Read more >REST API (API Gateway v1) - Serverless Framework
HTTP Endpoints with Custom Authorizers. Custom Authorizers allow you to run an AWS Lambda Function before your targeted AWS Lambda Function. This is...
Read more >Lambda@Edge fallback to custom origin from s3 with ...
request.origin = { custom: { domainName: 'www.example.com', port: 443, protocol: 'https', path: '', ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Any updates on this or maybe some workaround?
@mattvb91 yes I think as mentioned in the OP, https://github.com/serverless-nextjs/serverless-next.js/blob/828b9dde89a9cb2559c58ab4e798ee7cbcbdd5e6/packages/serverless-components/nextjs-component/src/component.ts#L647 as mentioned is the code that sets up the CloudFront configuration. Or you can try to use the CDK deployer as it might provide more flexibility