Skip to content

Commit 920eef6

Browse files
committed
docs: add additional behaviors for layout stability in CloudFront configuration
1 parent b4684fa commit 920eef6

1 file changed

Lines changed: 24 additions & 1 deletion

File tree

advanced/subpath/route53-cloudfront.mdx

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,29 @@ Lastly, we're going to edit the `Default (*)` behavior.
158158

159159
2. Select **Save changes**.
160160

161+
### Additional behaviors for layout stability
162+
163+
To prevent layout shifts and ensure smooth navigation, add these additional behaviors for static asset handling:
164+
165+
#### `/mintlify-assets/_next/static/*`
166+
167+
Create a behavior with a **Path pattern** of `/mintlify-assets/_next/static/*` to serve static assets efficiently:
168+
169+
- Set **Origin and origin groups** to your `.mintlify.dev` URL
170+
- Set **Cache policy** to **CachingOptimized**
171+
- Set **Origin request policy** to **AllViewerExceptHostHeader**
172+
173+
This behavior should be ordered **above** the default behavior in your behaviors list, as CloudFront evaluates them in order.
174+
175+
#### Update default behavior for app router navigation
176+
177+
For your **Default (*)** behavior, ensure these settings to handle HTML and app router navigation properly:
178+
179+
- Set **Cache policy** to **CachingDisabled** (since RSC ?_rsc= payloads vary and shouldn't be cached)
180+
- Set **Origin request policy** to **AllViewerExceptHostHeader**
181+
182+
These configurations prevent the sidenav from snapping up and down during navigation by ensuring only the new page's MDX content is fetched while keeping layout assets stable.
183+
161184
### Check behaviors are set up correctly
162185

163186
If you follow the above steps, your behaviors should look like this:
@@ -208,4 +231,4 @@ Now, we're going to bring the functionality of the CloudFront distribution into
208231

209232
Your documentation is now live at `/docs` for your primary domain.
210233

211-
<Propagating />
234+
<Propagating />

0 commit comments

Comments
 (0)