Every host and framework
Set up Constile on Fastly
Constile's gate runs in front of your pages. An AI agent fetching a page for a person gets an offer; people, search engines, and subscribers get your site as they do today.- Install the package
npm install https://constile.app/install/constile-gate-0.6.0.tgz
- Add the gate to your Compute service
import { SecretStore } from "fastly:secret-store"; import { constileGate } from "constile-gate/fastly"; const store = new SecretStore("constile"); const gate = (async () => constileGate({ siteId: (await store.get("CONSTILE_SITE_ID"))?.plaintext(), secret: (await store.get("CONSTILE_SITE_SECRET"))?.plaintext(), networkUrl: (await store.get("CONSTILE_NETWORK_URL"))?.plaintext(), originBackend: "origin", networkBackend: "constile_network", }))(); addEventListener("fetch", (event) => event.respondWith(gate.then((g) => g(event)))); - Set your site's settingsStore these in a Fastly secret store named
constile, and add backends namedorigin(your site) andconstile_network(the network).Your site's page shows its ID, and shows the secret once, when you add the site.CONSTILE_SITE_ID=your-site-id CONSTILE_SITE_SECRET=your-site-secret CONSTILE_NETWORK_URL=https://constile.app
- Check the installDeploy, then select Check install on your site's page. The network asks your domain for
/.well-known/constile, and the gate answers with your site secret. Then Test my site shows what a person, a search crawler, and an AI agent each get.
Turn it off
Fastest, from your dashboard: once the gate is installed, select Pause offers under Manage on your site's page. The network stops making offers, and the gate passes every request through within a minute. Nothing changes on your server.On your site: In Fastly, activate the service's previous version, from before the gate. It takes a few seconds.To take it out: Take the gate out of your Compute code and deploy.Off or paused, people, search crawlers, subscribers, and your other ads get your site exactly as before.