You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: advanced/subpath/route53-cloudfront.mdx
+49-22Lines changed: 49 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -47,22 +47,14 @@ You must include the `CloudFront-Viewer-Address` header in your origin request p
47
47

48
48
</Frame>
49
49
50
-
4. Select **Use: [SUBDOMAIN].mintlify.dev**.
51
-
52
-
5. For "Cache key and origin requests", select **CachingOptimized** for the "Cache policy".
53
-
54
-
<Frame>
55
-

56
-
</Frame>
57
-
58
-
6. For "Web Application Firewall (WAF)," enable security protections.
50
+
4. For "Web Application Firewall (WAF)," enable security protections.
59
51
60
52
<Frame>
61
53

62
54
</Frame>
63
55
64
-
7. The remaining settings should be default.
65
-
8. Select **Create distribution**.
56
+
5. The remaining settings should be default.
57
+
6. Select **Create distribution**.
66
58
67
59
## Add default origin
68
60
@@ -86,7 +78,11 @@ You must include the `CloudFront-Viewer-Address` header in your origin request p
86
78

87
79
</Frame>
88
80
89
-
By this point, you should have two Origins: one with `[SUBDOMAIN].mintlify.app` and another with with staging URL.
81
+
By this point, you should have two Origins: one with `[SUBDOMAIN].mintlify.app` and another with your staging URL.
82
+
83
+
<Frame>
84
+

85
+
</Frame>
90
86
91
87
## Set behaviors
92
88
@@ -95,33 +91,56 @@ Behaviors in Cloudfront enable control over the subpath logic. At a high level,
95
91
-**If a user lands on /docs**, go to `[SUBDOMAIN].mintlify.dev`.
96
92
-**If a user lands on any other page**, go the current landing page.
97
93
94
+
Navigate to the "Behaviors" tab of your Cloudfront distribution.
Select the **Create behavior** button and create the following behaviors.
99
101
100
102
### `/.well-known/*`
101
103
102
-
If you are deploying to Vercel, create a behavior for Vercel verification paths with a **Path pattern** of `/.well-known/*`and**Origin and origin groups**pointing to your main origin (the staging URL).
104
+
Create behaviors for Vercel domain verification paths with a **Path pattern** of `/.well-known/*`set**Origin and origin groups** to your docs URL.
103
105
104
106
For "Cache policy", select **CachingDisabled** to ensure these verification requests pass through without caching.
105
107
106
-
### `/docs/*`
108
+
<Frame>
109
+

110
+
</Frame>
107
111
108
-
Create a behavior with a **Path pattern** of `/docs/*` with **Origin and origin groups** pointing to the `.mintlify.dev` URL (in our case `acme.mintlify.dev`).
112
+
<Info>
113
+
If `.well-known/*` is too generic, it can be narrowed down to 2 behaviors at a minimum for Vercel:
114
+
-`/.well-known/vercel/*` - Required for Vercel domain verification
115
+
-`/.well-known/acme-challenge/*` - Required for Let's Encrypt certificate verification
116
+
</Info>
109
117
110
-
For "Cache policy", select **CachingOptimized**. If you are using a Vercel deployment, select **VercelCloudFrontProxy** for the "Origin request policy."
118
+
### `/docs`
119
+
120
+
Create a behavior with a **Path pattern** of `/docs` with **Origin and origin groups** pointing to the `.mintlify.dev` URL (in our case `acme.mintlify.dev`).
121
+
122
+
- Set "Cache policy" to **CachingOptimized**.
123
+
- In "Origin request policy". Create an origin request policy named **VercelCloudFrontProxy**. That forward the `Origin` and `CloudFront-Viewer-Address` headers.
124
+
125
+
<Frame>
126
+

127
+
</Frame>
128
+
129
+
- Set Viewer Protocol Policy to **Redirect HTTP to HTTPS**
111
130
112
131
<Frame>
113
132

114
133
</Frame>
115
134
116
-
### `/docs`
135
+
### `/docs/*`
117
136
118
-
Create a behavior with a **Path pattern** of `/docs` and **Origin and origin groups** pointing to the same `.mintlify.dev` URL.
137
+
Create a behavior with a **Path pattern** of `/docs/*` and **Origin and origin groups** pointing to the same `.mintlify.dev` URL.
119
138
120
-
If you are using a Vercel deployment, select **VercelCloudFrontProxy** for the "Origin request policy."
139
+
These settings should exactly match `/docs`. With the exception of the **Path pattern**.
121
140
122
-
<Frame>
123
-

124
-
</Frame>
141
+
- Set "Cache policy" to **CachingOptimized**.
142
+
- Set Origin request policy to **VercelCloudFrontProxy**.
143
+
- Set Viewer Protocol Policy to **Redirect HTTP to HTTPS**
125
144
126
145
### `Default (*)`
127
146
@@ -139,6 +158,14 @@ Lastly, we're going to edit the `Default (*)` behavior.
139
158
140
159
2. Select **Save changes**.
141
160
161
+
### Check Behaviors are set up correctly
162
+
163
+
If you follow the above steps, your behaviors should look like this:
164
+
165
+
<Frame>
166
+

167
+
</Frame>
168
+
142
169
## Preview distribution
143
170
144
171
You can now test if your distribution is set up properly by going to the "General" tab and visiting the **Distribution domain name** URL.
0 commit comments