Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions advanced/subpath/cloudflare.mdx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
---
title: "Cloudflare"
description: "Host documentation at a /docs subpath using Cloudflare Workers"

Check warning on line 3 in advanced/subpath/cloudflare.mdx

View check run for this annotation

Mintlify / Mintlify Validation - vale-spellcheck

advanced/subpath/cloudflare.mdx#L3

Did you really mean 'subpath'?
---

import Propagating from "/snippets/custom-subpath-propagating.mdx";

To host your documentation at a `/docs` subpath using Cloudflare, you will need to create and configure a Cloudflare Worker.

<Info>
Expand All @@ -14,7 +16,7 @@
Create a Cloudflare Worker by following the [Cloudflare Workers getting started guide](https://developers.cloudflare.com/workers/get-started/dashboard/), if you have not already.

<Warning>
If your DNS provider is Cloudflare, do not use proxying for the CNAME record.

Check warning on line 19 in advanced/subpath/cloudflare.mdx

View check run for this annotation

Mintlify / Mintlify Validation - vale-spellcheck

advanced/subpath/cloudflare.mdx#L19

Did you really mean 'proxying'?
</Warning>

### Configure routing
Expand Down Expand Up @@ -57,8 +59,9 @@
}
```

Select `Deploy` and wait for the changes to propagate (it can take up to a few
hours).
Select **Deploy** and wait for the changes to propagate.

<Propagating />

### Test your Worker

Expand All @@ -74,7 +77,7 @@
3. Add your domain.

<Tip>
We recommend you add your domain both with and without `www.` prepended.

Check warning on line 80 in advanced/subpath/cloudflare.mdx

View check run for this annotation

Mintlify / Mintlify Validation - vale-spellcheck

advanced/subpath/cloudflare.mdx#L80

Did you really mean 'prepended'?
</Tip>

See [Add a custom domain](https://developers.cloudflare.com/workers/configuration/routing/custom-domains/#add-a-custom-domain) in the Cloudflare documentation for more information.
Expand All @@ -86,14 +89,14 @@
1. Delete the existing DNS record for your domain. See [Delete DNS records](https://developers.cloudflare.com/dns/manage-dns-records/how-to/create-dns-records/#delete-dns-records) in the Cloudflare documentation for more information.
2. Return to your Worker and add your custom domain.

## Webflow custom routing

Check warning on line 92 in advanced/subpath/cloudflare.mdx

View check run for this annotation

Mintlify / Mintlify Validation - vale-spellcheck

advanced/subpath/cloudflare.mdx#L92

Did you really mean 'Webflow'?
If you use Webflow to host your main site and want to serve Mintlify docs at `/docs` on the same domain, you'll need to configure custom routing through Cloudflare Workers to proxy all non-docs traffic to your main site.

Check warning on line 93 in advanced/subpath/cloudflare.mdx

View check run for this annotation

Mintlify / Mintlify Validation - vale-spellcheck

advanced/subpath/cloudflare.mdx#L93

Did you really mean 'Webflow'?

<Warning>
Make sure your main site is set up on a landing page before deploying this Worker, or visitors to your main site will see errors.
</Warning>

1. In Webflow, set up a landing page for your main site like `landing.yoursite.com`. This will be the page that visitors see when they visit your site.

Check warning on line 99 in advanced/subpath/cloudflare.mdx

View check run for this annotation

Mintlify / Mintlify Validation - vale-spellcheck

advanced/subpath/cloudflare.mdx#L99

Did you really mean 'Webflow'?
2. Deploy your main site to the landing page. This ensures that your main site remains accessible while you configure the Worker.
3. To avoid conflicts, update any absolute URLs in your main site to be relative.
4. In Cloudflare, select **Edit Code** and add the following script into your Worker's code.
Expand Down Expand Up @@ -137,4 +140,6 @@
}
}
```
5. Select Deploy and wait for the changes to propagate, which can take up to a few hours.
5. Select **Deploy** and wait for the changes to propagate.

<Propagating />
6 changes: 5 additions & 1 deletion advanced/subpath/route53-cloudfront.mdx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
---
title: "AWS Route 53 and Cloudfront"

Check warning on line 2 in advanced/subpath/route53-cloudfront.mdx

View check run for this annotation

Mintlify / Mintlify Validation - vale-spellcheck

advanced/subpath/route53-cloudfront.mdx#L2

Did you really mean 'Cloudfront'?
sidebarTitle: "AWS"
description: "Host documentation at a /docs subdirectory using AWS services"
---

import Propagating from "/snippets/custom-subpath-propagating.mdx";

## Create Cloudfront Distribution

Check warning on line 9 in advanced/subpath/route53-cloudfront.mdx

View check run for this annotation

Mintlify / Mintlify Validation - vale-spellcheck

advanced/subpath/route53-cloudfront.mdx#L9

Did you really mean 'Cloudfront'?

Navigate to [Cloudfront](https://aws.amazon.com/cloudfront) inside the AWS console and click on `Create distribution`

Expand Down Expand Up @@ -40,10 +42,10 @@
We want to find a staging URL that mirrors where the main domain (example.com). This is highly variant depending on how your landing page is hosted.

<Info>
For instance, if your landing page is hosted on Webflow, you can use the

Check warning on line 45 in advanced/subpath/route53-cloudfront.mdx

View check run for this annotation

Mintlify / Mintlify Validation - vale-spellcheck

advanced/subpath/route53-cloudfront.mdx#L45

Did you really mean 'Webflow'?
Webflow's staging URL. It would look like `.webflow.io`.

Check warning on line 46 in advanced/subpath/route53-cloudfront.mdx

View check run for this annotation

Mintlify / Mintlify Validation - vale-spellcheck

advanced/subpath/route53-cloudfront.mdx#L46

Did you really mean 'Webflow's'?

If you use Vercel, you use the `.vercel.app` domain available for every project.

Check warning on line 48 in advanced/subpath/route53-cloudfront.mdx

View check run for this annotation

Mintlify / Mintlify Validation - vale-spellcheck

advanced/subpath/route53-cloudfront.mdx#L48

Did you really mean 'Vercel'?

</Info>
<Note>
Expand All @@ -59,11 +61,11 @@
![Cloudfront Default Origins](/images/cloudfront/default-origin.png)
</Frame>

By this point, you should have two Origins - one with `[SUBDOMAIN].mintlify.app` and another with with staging URL.

Check warning on line 64 in advanced/subpath/route53-cloudfront.mdx

View check run for this annotation

Mintlify / Mintlify Validation - vale-spellcheck

advanced/subpath/route53-cloudfront.mdx#L64

'with' is repeated!

## Set Behaviors

Behaviors in Cloudfront enables control over the subpath logic. At a high level, we're looking to create the following logic.

Check warning on line 68 in advanced/subpath/route53-cloudfront.mdx

View check run for this annotation

Mintlify / Mintlify Validation - vale-spellcheck

advanced/subpath/route53-cloudfront.mdx#L68

Did you really mean 'Cloudfront'?

Check warning on line 68 in advanced/subpath/route53-cloudfront.mdx

View check run for this annotation

Mintlify / Mintlify Validation - vale-spellcheck

advanced/subpath/route53-cloudfront.mdx#L68

Did you really mean 'subpath'?

- **If a user lands on /docs**, go to `[SUBDOMAIN].mintlify.dev`
- **If a user lands on any other page**, go the current landing page
Expand Down Expand Up @@ -113,7 +115,7 @@

## Connecting it with Route53

Now, we're going to bring the functionality of the Cloudfront distribution into your primary domain.

Check warning on line 118 in advanced/subpath/route53-cloudfront.mdx

View check run for this annotation

Mintlify / Mintlify Validation - vale-spellcheck

advanced/subpath/route53-cloudfront.mdx#L118

Did you really mean 'Cloudfront'?

<Note>
For this section, you can also refer to AWS's official guide on [Configuring
Expand All @@ -139,4 +141,6 @@
You may need to remove the existing A record if one currently exists.
</Note>

And voila! You should be able to have your documentation served at `/docs` for your primary domain.
And voila! Your documentation will be served at `/docs` for your primary domain.

<Propagating />
2 changes: 1 addition & 1 deletion snippets/custom-subpath-gating.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Info>
**Prerequisite**: Your primary domain (company.com) is hosted on {platform}
and you are on the [Pro plan or above](https://mintlify.com/pricing).
and you are on the [Pro, Growth, or Enterprise plan](https://mintlify.com/pricing).
</Info>
3 changes: 3 additions & 0 deletions snippets/custom-subpath-propagating.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Note>
After configuring your DNS, custom subdomains are usually available within a few minutes. DNS propagation can sometimes take 1-4 hours, and in rare cases up to 48 hours. If your subdomain is not immediately available, please wait before troubleshooting.
</Note>