aws / aws/aws-cdk

Cloudfront Distribution: Re-ordering behaviors

Open
#14,866 3 comments 16 reactions 0 assignees View on GitHub
@aws-cdk/aws-cloudfront effort/small feature-request p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

## :question: General Issue

### The Question

**Is there a way to re-order behaviors inside already created distribution?**

The reason why im asking this is that im using Serverless `NextJSLambdaEdge` constructor for deploying Next.js app. My Next app needs custom distribution behaviors for several api routes but these behaviours drops on bottom of the list which makes them overridden by rules above.

For reference `NextJSLambdaEdge` constructor creates the distribution here:

https://github.com/serverless-nextjs/serverless-next.js/blob/master/packages/serverless-components/nextjs-cdk-construct/src/index.ts#L289-L308

I have asked a feature in order to adding custom behaviors. Here you can also see how im adding behaviors now without being able to set the specific order/precedence for them.

https://github.com/serverless-nextjs/serverless-next.js/issues/1069

### Environment

- **CDK CLI Version:** 1.100.0
- **Module Version:** 1.100.0
- **Node.js Version:** 14.x
- **Language (Version):** JS / TypeScript

Contributor guide

Open the contributing guide

Research direction

Start by reading the NextJSLambdaEdge distribution construction in packages/serverless-components/nextjs-cdk-construct/src/index.ts at the referenced lines, then review serverless-next.js issue 1069 for the requested custom behaviors. Determine how behavior precedence is represented for an already created distribution; done means the requested ordering can be specified or the supported limitation is clearly established.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cloud, infrastructure
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.