---
title: Supertab Connect
summary: null
url: >-
  https://www.fastly.com/documentation/guides/integrations/non-fastly-services/supertab
---

Fastly [Compute](https://www.fastly.com/products/edge-compute) can be integrated with [Supertab Connect](https://www.supertab.co/supertab-connect) to publish your [RSL license](https://rslstandard.org/), identify AI crawlers, validate [Crawler Authentication Protocol license](https://rslstandard.org/rsl#_6-crawler-authorization-protocol-cap) (CAP) tokens, and control access to your content.

## Prerequisites

To use this integration, you must have:

- a [Compute](https://www.fastly.com/documentation/guides/getting-started/services/working-with-compute-services) or [CDN service](https://www.fastly.com/documentation/guides/getting-started/services/working-with-cdn-services) already created
- a [Supertab Connect](https://www.supertab.co/contact) 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](https://connect-docs.supertab.co/guides/deploy-cdn) documentation and their [Fastly](https://connect-docs.supertab.co/reference/fastly/connect-on-fastly) reference information.

## Using Supertab with Fastly services

Follow these steps to use Supertab with Fastly Compute and CDN services.

### Compute 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:

   | Details              | Settings                  |
   | -------------------- | ------------------------- |
   | Name                 | `stc-backend`             |
   | Address              | `api-connect.supertab.co` |
   | Port                 | `443`                     |
   | TLS                  | `enabled`                 |
   | SNI hostname         | `api-connect.supertab.co` |
   | Certificate hostname | `api-connect.supertab.co` |
   | Override host        | `api-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.

   ```terminal
   npm install @getsupertab/supertab-connect-sdk
   ```

5. Add the following request handler to your Compute application:

   ```javascript
   /// <reference types="@fastly/js-compute" />

   import {
     EnforcementMode,
     SupertabConnect
   } from "@getsupertab/supertab-connect-sdk";

   ```

   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.
1. Build and deploy the Compute service, and link the `supertab_config` Secret Store to it.
1. Confirm that the following URL returns your RSL license:

```plaintext
https://yourdomain.com/license.xml
````

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

### Cdn Services

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

Start by configuring RSL License publishing:

1. Add a backend to your VCL service with the following configuration:

   | Details              | Settings                   |
   | -------------------- | -------------------------- |
   | Name                 | `supertab-connect-backend` |
   | Address              | `api-connect.supertab.co`  |
   | Port                 | `443`                      |
   | TLS                  | `enabled`                  |
   | SNI hostname         | `api-connect.supertab.co`  |
   | Certificate hostname | `api-connect.supertab.co`  |
   | Override host        | `api-connect.supertab.co`  |

2. Add the following request [condition](https://www.fastly.com/documentation/guides/full-site-delivery/conditions/using-conditions) to the backend:

   ```terminal
   req.url ~ "^/merchants/systems/YOUR_WEBSITE_URN/license\.xml(\?|$)"
   ```

   Be sure to replace `YOUR_WEBSITE_URN` with the Website URN from the Supertab Connect dashboard.

3. Create the following `recv` [VCL snippet](https://www.fastly.com/documentation/guides/full-site-delivery/fastly-vcl/vcl-snippets/using-vcl-snippets) and set the priority level to 100:

   ```terminal
   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:

1. Create a [Compute service](https://www.fastly.com/documentation/guides/getting-started/services/working-with-compute-services).

2. To this service, add

   - a backend for your normal website origin
   - a backend named `stc-backend` pointing to `api-connect.supertab.co:443` with TLS enabled
   - a Secret Store named `supertab_config`
   - a secret named `MERCHANT_API_KEY` containing your Supertab Merchant API Key

3. Install the Supertab Connect SDK.

   ```terminal
   npm install @getsupertab/supertab-connect-sdk
   ```

4. Add the following request handler:

   ```javascript
   /// <reference types="@fastly/js-compute" />

   import {
     EnforcementMode,
     SupertabConnect
   } from "@getsupertab/supertab-connect-sdk";

   ```

   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_BACKEND` with the name of your website origin backend and `YOUR_WEBSITE_URN` with the name of your Supertab Connect dashboard.

1. Deploy the Compute service and note its automatically assigned domain:

```terminal
your-compute-service.edgecompute.app
````

Then finish the installation:

1. In your VCL service, add a backend named `supertab-compute-validator` that points to the Compute service domain.

2. On that backend, enable TLS and use the Compute domain you noted previously for the SNI hostname, certificate hostname, and host override.

3. In your VCL service, add a `recv` VCL snippet:

   ```vcl
   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.

4. In your VCL service, add a `pass` VCL snippet:

   ```vcl
   declare 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-Url` header is required so Supertab Connect can verify that the license token applies to the requested URL.

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


