Overview
Flint hosts Flint pages on Flint servers. There are two options for integration:
- 1.Subdomain (e.g. assistant.yelp.com)
- 2.Subpath (e.g. yelp.com/assistant/*)
Subdomain:
- •Pro: Simple to setup with DNS record
- •Con: Significantly less optimized for SEO
Subpath:
- •Pro: Usable for SEO, better branding
- •Con: More difficult infrastructure and security configuration
Option 1: Subdomain (lp.your-company.com)
The simpler setup. Just add a CNAME record to your DNS and you're ready to go.
Option 2: Subdirectory (your-company.com/lp)
Can be done via Cloudflare Worker or Vercel rewrite, depending on your setup.
Example: Vercel Configuration
To set up subpath forwarding for a Vercel hosted site, configure this within the vercel.json file:
{
"rewrites": [
{
"source": "/lp",
"destination": "https://yoursite.tryflint.com/lp"
},
{
"source": "/lp/:match*",
"destination": "https://yoursite.tryflint.com/lp/:match*"
}
]
}Set up a Cloudflare Worker
If one doesn't exist, create a Cloudflare Worker by following the Cloudflare Workers getting started guide.
Configure Routing
In your Cloudflare dashboard, select Edit Code and add the following script into your Worker's code. See the Cloudflare documentation for more information on editing a Worker.
Replace [FLINT_SUBDOMAIN] with the Flint subdomain, and [YOUR_DOMAIN] with your website's base URL.
export default {
async fetch(request) {
// Grab the original URL
const url = new URL(request.url);
const upstreamPath = url.pathname;
// Build the upstream URL
const upstream = new URL(`https://[FLINT_SUBDOMAIN].tryflint.com${upstreamPath}`);
// Clone the original request
const init = {
method: request.method,
headers: request.headers,
body: request.body
};
return fetch(upstream, init);
}
}