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.

  1. Compute services
  2. CDN services

Follow these steps to use Supertab with a Fastly Compute service.

  1. 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.

  2. Add a second backend with the following configuration:

    DetailsSettings
    Namestc-backend
    Addressapi-connect.supertab.co
    Port443
    TLSenabled
    SNI hostnameapi-connect.supertab.co
    Certificate hostnameapi-connect.supertab.co
    Override hostapi-connect.supertab.co
  3. Create a Secret Store named supertab.config containing your Merchant API Key (from your Supertab Connect dashboard).

  4. Install the Supertab Connect SDK.

    npm install @getsupertab/supertab-connect-sdk
  5. Add the following request handler to your Compute application:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    /// <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 SDK
    merchantSystemUrn: "YOUR_WEBSITE_URN",
    enforcement: EnforcementMode.SOFT
    }
    );
    })());
    });

    Be sure to replace YOUR_ORIGIN_BACKEND with the name of your website origin backend and YOUR_WEBSITE_URN with the name of your Supertab Connect dashboard.

  6. Build and deploy the Compute service, and link the supertab_config Secret Store to it.

  7. Confirm that the following URL returns your RSL license:

    https://yourdomain.com/license.xml
  8. Once 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 the Authorization: License <token> header and blocks identified crawler requests with missing or invalid license tokens.