Supertab Connect
Fastly Compute can be integrated with Supertab Connect to publish your RSL license, identify AI crawlers, validate Crawler Authentication Protocol license (CAP) tokens, and control access to your content.
Prerequisites
To use this integration, you must have:
- a Compute or CDN service already created
- a Supertab Connect account
- a Merchant API key from your Supertab Connect account
- a Website URN (the name of your Supertab Connect dashboard)
For additional details, check out Supertab's Deploy at the Edge documentation and their Fastly reference information.
Using Supertab with Fastly services
Follow these steps to use Supertab with Fastly Compute and CDN services.
- Compute services
- CDN services
Follow these steps to use Supertab with a Fastly Compute service.
Add your website origin as a backend in your Fastly Compute service and note the name you used. You'll reference in code samples later in these instructions.
Add a second backend with the following configuration:
Details Settings Name stc-backendAddress api-connect.supertab.coPort 443TLS enabledSNI hostname api-connect.supertab.coCertificate hostname api-connect.supertab.coOverride host api-connect.supertab.coCreate a Secret Store named
supertab.configcontaining your Merchant API Key (from your Supertab Connect dashboard).Install the Supertab Connect SDK.
npm install @getsupertab/supertab-connect-sdkAdd the following request handler to your Compute application:
1234567891011121314151617181920212223242526272829303132333435/// <reference types="@fastly/js-compute" />import {EnforcementMode,SupertabConnect} from "@getsupertab/supertab-connect-sdk";import { SecretStore } from "fastly:secret-store";const isBot = (request) => {// If you have bot detection logic such as Fastly Bot Management, implement// it here. The SDK uses this to decide which requests must present a// valid License token.return false;};addEventListener("fetch", (event) => {event.respondWith((async () => {const secrets = new SecretStore("supertab_config");const entry = await secrets.get("MERCHANT_API_KEY");const merchantApiKey = entry?.plaintext() ?? "";return SupertabConnect.fastlyHandleRequests(event.request,merchantApiKey,"YOUR_ORIGIN_BACKEND",{botDetector: isBot,enableRSL: true, // serve /license.xml from the SDKmerchantSystemUrn: "YOUR_WEBSITE_URN",enforcement: EnforcementMode.SOFT});})());});Be sure to replace
YOUR_ORIGIN_BACKENDwith the name of your website origin backend andYOUR_WEBSITE_URNwith the name of your Supertab Connect dashboard.Build and deploy the Compute service, and link the
supertab_configSecret Store to it.Confirm that the following URL returns your RSL license:
https://yourdomain.com/license.xmlOnce you're ready to require valid licenses from identified crawlers, change the enforcement mode in the request handler to
enforcement: EnforcementMode.STRICT. In strict mode, Supertab Connect validates theAuthorization: License <token>header and blocks identified crawler requests with missing or invalid license tokens.
Follow these steps to use Supertab with a Fastly CDN service.
Start by configuring RSL License publishing:
Add a backend to your VCL service with the following configuration:
Details Settings Name supertab-connect-backendAddress api-connect.supertab.coPort 443TLS enabledSNI hostname api-connect.supertab.coCertificate hostname api-connect.supertab.coOverride host api-connect.supertab.coAdd the following request condition to the backend:
req.url ~ "^/merchants/systems/YOUR_WEBSITE_URN/license\.xml(\?|$)"Be sure to replace
YOUR_WEBSITE_URNwith the Website URN from the Supertab Connect dashboard.Create the following
recvVCL snippet and set the priority level to 100:if (req.url.path == "/license.xml") {set req.url = "/merchants/systems/YOUR_WEBSITE_URN/license.xml";}
This makes your RSL license available at https://yourdomain.com/license.xml.
Next, configure the Compute validator:
Create a Compute service.
To this service, add
- a backend for your normal website origin
- a backend named
stc-backendpointing toapi-connect.supertab.co:443with TLS enabled - a Secret Store named
supertab_config - a secret named
MERCHANT_API_KEYcontaining your Supertab Merchant API Key
Install the Supertab Connect SDK.
npm install @getsupertab/supertab-connect-sdkAdd the following request handler:
1234567891011121314151617181920212223242526272829303132/// <reference types="@fastly/js-compute" />import {EnforcementMode,SupertabConnect} from "@getsupertab/supertab-connect-sdk";import { SecretStore } from "fastly:secret-store";const isBot = (request) => {// In case you have bot-detection logic, e.g. Fastly Bot Management, implement it here.// The SDK uses this to decide which requests must present a valid License token.return false;};addEventListener("fetch", (event) => {event.respondWith((async () => {const secrets = new SecretStore("supertab_config");const entry = await secrets.get("MERCHANT_API_KEY");const merchantApiKey = entry?.plaintext() ?? "";return SupertabConnect.fastlyHandleRequests(event.request,merchantApiKey,"YOUR_ORIGIN_BACKEND",{botDetector: isBot,enforcement: EnforcementMode.STRICT});})());});Be sure to replace
YOUR_ORIGIN_BACKENDwith the name of your website origin backend andYOUR_WEBSITE_URNwith the name of your Supertab Connect dashboard.Deploy the Compute service and note its automatically assigned domain:
your-compute-service.edgecompute.app
Then finish the installation:
In your VCL service, add a backend named
supertab-compute-validatorthat points to the Compute service domain.On that backend, enable TLS and use the Compute domain you noted previously for the SNI hostname, certificate hostname, and host override.
In your VCL service, add a
recvVCL snippet:if (req.http.Authorization ~ "^License ") {set req.backend = F_supertab_compute_validator;return (pass);}NOTE: The generated backend identifier may differ depending on the backend name configured in Fastly.
In your VCL service, add a
passVCL snippet:12345678910declare local var.scheme STRING;if (req.is_ssl) {set var.scheme = "https";} else {set var.scheme = "http";}set bereq.http.X-Original-Request-Url =var.scheme "://" req.http.host req.url;NOTE: The
X-Original-Request-Urlheader is required so Supertab Connect can verify that the license token applies to the requested URL.Activate the new VCL service version.
Requests containing an Authorization: License <token> header will now be routed through the Compute validator. Valid requests will be forwarded to your origin, while invalid tokens will be rejected.
Requests without a license token continue through your existing VCL request flow. To block or redirect unlicensed AI crawlers, configure an additional Bot Management or VCL rule.