> ## Documentation Index
> Fetch the complete documentation index at: https://gcore.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Extend CDN functionality with FastEdge

export const MethodSection = ({children}) => children ?? null;

export const MethodSwitch = ({children}) => {
  const tabs = React.Children.toArray(children).map(c => {
    if (!c || !c.props) return null;
    if (c.props.id) return c;
    const inner = c.props.children;
    if (inner && inner.props && inner.props.id) return inner;
    return null;
  }).filter(Boolean);
  const firstId = tabs.length > 0 ? tabs[0].props.id : "";
  const [active, setActive] = React.useState(firstId);
  React.useEffect(() => {
    try {
      const saved = localStorage.getItem("gcore_docs_method");
      if (saved && tabs.find(t => t.props.id === saved)) {
        setActive(saved);
      }
    } catch (_) {}
  }, []);
  React.useEffect(() => {
    try {
      document.querySelectorAll("h2[id], h3[id]").forEach(heading => {
        const visible = heading.offsetParent !== null;
        document.querySelectorAll(`a[href="#${heading.id}"]`).forEach(link => {
          if (link.closest("h1,h2,h3,h4,h5,h6")) return;
          const li = link.closest("li");
          if (li) li.style.display = visible ? "" : "none";
        });
      });
    } catch (_) {}
    window.dispatchEvent(new Event("scroll"));
  }, [active]);
  const handleClick = id => {
    setActive(id);
    try {
      localStorage.setItem("gcore_docs_method", id);
    } catch (_) {}
  };
  return <div>
      <div className="not-prose flex gap-0 border-b border-zinc-200 dark:border-zinc-800 mb-8 mt-2" role="tablist">
        {tabs.map(tab => {
    const isActive = active === tab.props.id;
    return <button key={tab.props.id} role="tab" aria-selected={isActive} onClick={() => handleClick(tab.props.id)} className={["px-4 py-2 text-sm font-medium border-b-2 -mb-px transition-colors cursor-pointer", isActive ? "border-primary text-primary" : "border-transparent text-zinc-500 hover:text-zinc-800 dark:hover:text-zinc-200"].join(" ")}>
              {tab.props.label}
            </button>;
  })}
      </div>

      {tabs.map(tab => <div key={tab.props.id} style={{
    display: active === tab.props.id ? "" : "none"
  }}>
          {tab.props.children}
        </div>)}
    </div>;
};

<MethodSwitch>
  <MethodSection id="portal" label="Customer Portal">
    FastEdge CDN applications run inside the CDN request pipeline and modify requests and responses before they reach the origin or client.

    A CDN resource configured for the origin is required. To create one, follow the [CDN resource](/cdn/getting-started/create-a-cdn-resource/overview) guide.

    ## How it works

    The CDN runtime invokes a CDN application at five stages of the request lifecycle:

    * **On request headers (before cache):** when the CDN receives request headers, before the cache is checked.
    * **On request headers (after cache):** when the CDN receives request headers, after the cache is checked.
    * **On request body:** when the CDN receives the request body.
    * **On response headers:** before the CDN sends response headers to the client.
    * **On response body:** before the CDN sends the response body to the client.

    <Info>CDN applications are built on the [Proxy-Wasm](https://github.com/proxy-wasm/spec) specification — an open standard for WebAssembly-based proxy extensions.</Info>

    <Warning>Only one FastEdge application can be attached to each processing stage.</Warning>

    ## Step 1. Create a FastEdge application

    <p>Deploy an application from a predefined template or upload a custom binary. Custom binaries must conform to the [Proxy-Wasm](https://github.com/proxy-wasm/spec) specification.</p>

    <Tabs>
      <Tab title="Deploy from template">
        <p>A predefined template is available for JWT authentication. It verifies the JSON Web Token in the request `Authorization` header before the request reaches the origin.</p>

        1. In the [Gcore Customer Portal](https://portal.gcore.com), navigate to **FastEdge**.
        2. Open the **CDN Applications** page and click **Create new application**.

        <Frame>
          <img src="https://mintcdn.com/gcore/MFAXqa6tFHU8UZIW/images/docs/fastedge/getting-started/integrate-cdn-with-fastedge/cdn-apps-page-create-app.png?fit=max&auto=format&n=MFAXqa6tFHU8UZIW&q=85&s=86c633b27f24b17cc1ce125aa4254b93" alt="CDN Applications page with Create new application button" width="1324" height="376" data-path="images/docs/fastedge/getting-started/integrate-cdn-with-fastedge/cdn-apps-page-create-app.png" />
        </Frame>

        3. In the **Create from a template** section, select **Validate JWT in Authorization header**.

        <Frame>
          <img src="https://mintcdn.com/gcore/MFAXqa6tFHU8UZIW/images/docs/fastedge/getting-started/integrate-cdn-with-fastedge/validate-jwt.png?fit=max&auto=format&n=MFAXqa6tFHU8UZIW&q=85&s=de3d42c678cbc863061e0ac08f18e700" alt="Create from a template section showing Validate JWT template option" width="1600" height="900" data-path="images/docs/fastedge/getting-started/integrate-cdn-with-fastedge/validate-jwt.png" />
        </Frame>

        4. Enter a name for the application and, optionally, a description.
        5. Add the required environment variables, such as a token signing key for authentication checks.

        <Frame>
          <img src="https://mintcdn.com/gcore/MFAXqa6tFHU8UZIW/images/docs/fastedge/getting-started/integrate-cdn-with-fastedge/cdn-app-from-template-setup.png?fit=max&auto=format&n=MFAXqa6tFHU8UZIW&q=85&s=20e6b29f5aaf7a1c6905b16d94cda922" alt="JWT template configuration form with Name and environment variables fields" width="1173" height="621" data-path="images/docs/fastedge/getting-started/integrate-cdn-with-fastedge/cdn-app-from-template-setup.png" />
        </Frame>

        6. Click **Save and deploy**.

        <p>The application is deployed and ready to be linked to a CDN resource.</p>

        <Frame>
          <img src="https://mintcdn.com/gcore/MFAXqa6tFHU8UZIW/images/docs/fastedge/getting-started/integrate-cdn-with-fastedge/cdn-app-created.png?fit=max&auto=format&n=MFAXqa6tFHU8UZIW&q=85&s=9cde370bf9ffeac0ff4149e2104e2576" alt="Application overview page showing active status" width="1151" height="427" data-path="images/docs/fastedge/getting-started/integrate-cdn-with-fastedge/cdn-app-created.png" />
        </Frame>

        <p>To adjust the configuration later, click **Actions** > **Edit application**.</p>

        <Frame>
          <img src="https://mintcdn.com/gcore/MFAXqa6tFHU8UZIW/images/docs/fastedge/getting-started/integrate-cdn-with-fastedge/actions-edit-app-from-template.png?fit=max&auto=format&n=MFAXqa6tFHU8UZIW&q=85&s=f18a4c948162b39030d878bed0869bd4" alt="Application overview page with Actions menu showing Edit application option" width="1169" height="241" data-path="images/docs/fastedge/getting-started/integrate-cdn-with-fastedge/actions-edit-app-from-template.png" />
        </Frame>
      </Tab>

      <Tab title="Deploy custom binary">
        <p>Custom implementations are available in the [FastEdge-sdk-rust examples](https://github.com/G-Core/FastEdge-sdk-rust/examples) and [proxy-wasm-sdk-as examples](https://github.com/G-Core/proxy-wasm-sdk-as/examples) repositories.</p>

        1. In the [Gcore Customer Portal](https://portal.gcore.com), navigate to **FastEdge**.
        2. Open the **CDN Applications** page and click **Create new application**.

        <Frame>
          <img src="https://mintcdn.com/gcore/MFAXqa6tFHU8UZIW/images/docs/fastedge/getting-started/integrate-cdn-with-fastedge/cdn-apps-page-create-app.png?fit=max&auto=format&n=MFAXqa6tFHU8UZIW&q=85&s=86c633b27f24b17cc1ce125aa4254b93" alt="CDN Applications page with Create new application button" width="1324" height="376" data-path="images/docs/fastedge/getting-started/integrate-cdn-with-fastedge/cdn-apps-page-create-app.png" />
        </Frame>

        3. Click **Upload binary**.

        <Frame>
          <img src="https://mintcdn.com/gcore/MFAXqa6tFHU8UZIW/images/docs/fastedge/getting-started/integrate-cdn-with-fastedge/cdn-apps-upload-binary.png?fit=max&auto=format&n=MFAXqa6tFHU8UZIW&q=85&s=ab471fdc8096464bc711f7e2e9a7e9ed" alt="Create application page with Upload binary card" width="1600" height="900" data-path="images/docs/fastedge/getting-started/integrate-cdn-with-fastedge/cdn-apps-upload-binary.png" />
        </Frame>

        4. Select the compiled `.wasm` file.

        <Frame>
          <img src="https://mintcdn.com/gcore/MFAXqa6tFHU8UZIW/images/docs/fastedge/getting-started/integrate-cdn-with-fastedge/upload-binary-dialog.png?fit=max&auto=format&n=MFAXqa6tFHU8UZIW&q=85&s=43d32769921d9f3c2a96684d8cf3cc7b" alt="File selection dialog for uploading a binary" width="1238" height="822" data-path="images/docs/fastedge/getting-started/integrate-cdn-with-fastedge/upload-binary-dialog.png" />
        </Frame>

        5. Enter a name for the application and, optionally, a description.
        6. Add any required environment variables as key-value pairs. For sensitive values, click **+ Add Secret** to store them in [Secrets Manager](/fastedge/secrets-manager/manage-secrets) instead.

        <Frame>
          <img src="https://mintcdn.com/gcore/MFAXqa6tFHU8UZIW/images/docs/fastedge/getting-started/integrate-cdn-with-fastedge/cdn-app-setup.png?fit=max&auto=format&n=MFAXqa6tFHU8UZIW&q=85&s=80b2c028b2b60516ef51511da2f51fad" alt="Custom app configuration form with Name, environment variables, and Secrets fields" width="1600" height="900" data-path="images/docs/fastedge/getting-started/integrate-cdn-with-fastedge/cdn-app-setup.png" />
        </Frame>

        7. Click **Save and deploy**.

        <p>The application is deployed and ready to be linked to a CDN resource. To adjust the configuration later, click **Actions** > **Edit application**.</p>

        <Frame>
          <img src="https://mintcdn.com/gcore/MFAXqa6tFHU8UZIW/images/docs/fastedge/getting-started/integrate-cdn-with-fastedge/actions-edit-app.png?fit=max&auto=format&n=MFAXqa6tFHU8UZIW&q=85&s=f2a205f6e40f196340c452db81d5df0a" alt="Application overview page with Actions menu showing Edit application option" width="1600" height="900" data-path="images/docs/fastedge/getting-started/integrate-cdn-with-fastedge/actions-edit-app.png" />
        </Frame>
      </Tab>
    </Tabs>

    ## Step 2. Enable FastEdge for your CDN resource

    <p>FastEdge can be enabled for all requests on a CDN resource, or limited to specific URL paths using CDN rules.</p>

    <Tabs>
      <Tab title="For a whole CDN resource">
        1. In the Customer Portal, navigate to **CDN**.
        2. Find the resource and open its settings.

        <Frame>
          <img src="https://mintcdn.com/gcore/MFAXqa6tFHU8UZIW/images/docs/fastedge/getting-started/integrate-cdn-with-fastedge/cdn-resource-settings-button.png?fit=max&auto=format&n=MFAXqa6tFHU8UZIW&q=85&s=3b8992263f690058ebc5fb04851ee828" alt="CDN resources list with resource settings button" width="1407" height="539" data-path="images/docs/fastedge/getting-started/integrate-cdn-with-fastedge/cdn-resource-settings-button.png" />
        </Frame>

        3. Scroll to the **FastEdge apps** section and enable the toggle for the required stage.

        <Frame>
          <img src="https://mintcdn.com/gcore/MFAXqa6tFHU8UZIW/images/docs/fastedge/getting-started/integrate-cdn-with-fastedge/cdn-fast-edge-1.png?fit=max&auto=format&n=MFAXqa6tFHU8UZIW&q=85&s=36b1cd9c97be476230737375e89217ff" alt="CDN resource settings showing FastEdge apps section with event toggles" width="1600" height="900" data-path="images/docs/fastedge/getting-started/integrate-cdn-with-fastedge/cdn-fast-edge-1.png" />
        </Frame>

        4. Select the application from the dropdown.

        <Frame>
          <img src="https://mintcdn.com/gcore/MFAXqa6tFHU8UZIW/images/docs/fastedge/getting-started/integrate-cdn-with-fastedge/cdn-fast-edge-2.png?fit=max&auto=format&n=MFAXqa6tFHU8UZIW&q=85&s=590c5be646060647d0857ab66dea7ee0" alt="FastEdge apps section with On request headers enabled and application dropdown" width="1600" height="900" data-path="images/docs/fastedge/getting-started/integrate-cdn-with-fastedge/cdn-fast-edge-2.png" />
        </Frame>

        5. (Optional) Select the **Interrupt request processing in case of error** checkbox.

        <Info>
          The **Interrupt request processing in case of error** checkbox is enabled by default. When active, errors on the FastEdge side return the relevant response code to the client. When disabled, the CDN ignores the error and forwards the request to the origin. For security-sensitive applications, keep this checkbox enabled.
        </Info>

        6. Click **Save**.
      </Tab>

      <Tab title="For specific URL paths">
        <p>URL-specific rules apply FastEdge logic only to certain paths — for example, protecting `/api/` with JWT validation while leaving other paths unaffected.</p>

        1. In the Customer Portal, navigate to **CDN**.
        2. Find the resource and open its settings.
        3. Click **Rules** > **Create rule**.

        <Frame>
          <img src="https://mintcdn.com/gcore/MFAXqa6tFHU8UZIW/images/docs/fastedge/getting-started/integrate-cdn-with-fastedge/cdn-settings-rules-section.png?fit=max&auto=format&n=MFAXqa6tFHU8UZIW&q=85&s=eb5a211e50e4ffa283d913bae390f125" alt="CDN resource settings with Rules tab open" width="1405" height="382" data-path="images/docs/fastedge/getting-started/integrate-cdn-with-fastedge/cdn-settings-rules-section.png" />
        </Frame>

        4. Click **Create blank rule**.
        5. Enter a rule name.
        6. In the **Match criteria** section, specify the URL paths affected by the application.
        7. In the **Options** section, click **Add option**.
        8. Scroll to the **FastEdge apps** section and enable the toggle for the required stage.

        <Frame>
          <img src="https://mintcdn.com/gcore/MFAXqa6tFHU8UZIW/images/docs/fastedge/getting-started/integrate-cdn-with-fastedge/cdn-fast-edge-1.png?fit=max&auto=format&n=MFAXqa6tFHU8UZIW&q=85&s=36b1cd9c97be476230737375e89217ff" alt="CDN resource settings showing FastEdge apps section with event toggles" width="1600" height="900" data-path="images/docs/fastedge/getting-started/integrate-cdn-with-fastedge/cdn-fast-edge-1.png" />
        </Frame>

        9. Select the application from the dropdown.

        <Frame>
          <img src="https://mintcdn.com/gcore/MFAXqa6tFHU8UZIW/images/docs/fastedge/getting-started/integrate-cdn-with-fastedge/cdn-fast-edge-2.png?fit=max&auto=format&n=MFAXqa6tFHU8UZIW&q=85&s=590c5be646060647d0857ab66dea7ee0" alt="FastEdge apps section with On request headers enabled and application dropdown" width="1600" height="900" data-path="images/docs/fastedge/getting-started/integrate-cdn-with-fastedge/cdn-fast-edge-2.png" />
        </Frame>

        10. (Optional) Select the **Interrupt request processing in case of error** checkbox.

        <Frame>
          <img src="https://mintcdn.com/gcore/MFAXqa6tFHU8UZIW/images/docs/fastedge/getting-started/integrate-cdn-with-fastedge/rule-options-fastedge-app-enable.png?fit=max&auto=format&n=MFAXqa6tFHU8UZIW&q=85&s=8764c09c1e84b8ce3b64007340488f06" alt="Add option dialog showing FastEdge apps section" width="1504" height="760" data-path="images/docs/fastedge/getting-started/integrate-cdn-with-fastedge/rule-options-fastedge-app-enable.png" />
        </Frame>

        <Info>
          The **Interrupt request processing in case of error** checkbox is enabled by default. When active, errors on the FastEdge side return the relevant response code to the client. When disabled, the CDN ignores the error and forwards the request to the origin.
        </Info>

        11. Click **Create rule**.
      </Tab>
    </Tabs>

    ## Disconnect FastEdge from CDN

    <p>To stop FastEdge processing on a CDN resource, disable the configured toggles and save.</p>

    1. In the Customer Portal, navigate to **CDN**.
    2. Find the resource and open its settings.

    <Frame>
      <img src="https://mintcdn.com/gcore/MFAXqa6tFHU8UZIW/images/docs/fastedge/getting-started/integrate-cdn-with-fastedge/cdn-resource-settings-button.png?fit=max&auto=format&n=MFAXqa6tFHU8UZIW&q=85&s=3b8992263f690058ebc5fb04851ee828" alt="CDN resources list with resource settings button" width="1407" height="539" data-path="images/docs/fastedge/getting-started/integrate-cdn-with-fastedge/cdn-resource-settings-button.png" />
    </Frame>

    3. To disable FastEdge for the **whole CDN resource**, disable the toggles in the **FastEdge apps** section.
    4. To disable FastEdge for **specific URL paths**, open the **Rules** page and disable the toggle for the relevant rule.
    5. Click **Save changes**.

    ## Delete a CDN application

    <Info>
      An enabled FastEdge application linked to a CDN resource cannot be deleted. Disconnect it from the CDN resource first.
    </Info>

    1. In the Customer Portal, navigate to **FastEdge**.
    2. Open the **CDN Applications** page and click the three-dot icon next to the application.

    <Frame>
      <img src="https://mintcdn.com/gcore/MFAXqa6tFHU8UZIW/images/docs/fastedge/getting-started/integrate-cdn-with-fastedge/remove-app-fstedge.png?fit=max&auto=format&n=MFAXqa6tFHU8UZIW&q=85&s=44f87d6bd481629884b895083cad12ce" alt="CDN Applications list with three-dot menu open showing Delete option" width="1405" height="445" data-path="images/docs/fastedge/getting-started/integrate-cdn-with-fastedge/remove-app-fstedge.png" />
    </Frame>

    3. Click **Delete**.
    4. Confirm by clicking **Yes, delete**.

    <Frame>
      <img src="https://mintcdn.com/gcore/MFAXqa6tFHU8UZIW/images/docs/fastedge/getting-started/integrate-cdn-with-fastedge/confirm-deletion.png?fit=max&auto=format&n=MFAXqa6tFHU8UZIW&q=85&s=9ca57f47efcd708e042cf737a4cd79e2" alt="Delete app confirmation dialog" width="735" height="673" data-path="images/docs/fastedge/getting-started/integrate-cdn-with-fastedge/confirm-deletion.png" />
    </Frame>
  </MethodSection>

  <MethodSection id="api" label="REST API">
    FastEdge CDN applications run inside the CDN request pipeline and modify requests and responses before they reach the origin or client.

    A CDN resource configured for the origin is required. To create one, use the [Create CDN resource](/api-reference/cdn/cdn-resources/create-cdn-resource) API endpoint.

    <p>All requests authenticate with an [API token](/account-settings/api-tokens). Set it as an environment variable before running the examples:</p>

    ```bash theme={null}
    export GCORE_API_KEY="{YOUR_API_KEY}"
    ```

    ## How it works

    The CDN runtime invokes a CDN application at five stages of the request lifecycle:

    * **on\_request\_headers:** when the CDN receives request headers, before cache.
    * **on\_request\_headers\_after\_cache:** when the CDN receives request headers, after cache.
    * **on\_request\_body:** when the CDN receives the request body.
    * **on\_response\_headers:** before the CDN sends response headers to the client.
    * **on\_response\_body:** before the CDN sends the response body to the client.

    <Info>CDN applications are built on the [Proxy-Wasm](https://github.com/proxy-wasm/spec) specification — an open standard for WebAssembly-based proxy extensions.</Info>

    <Warning>Only one FastEdge application can be attached to each processing stage.</Warning>

    ## Step 1. Upload a binary

    <p>Upload the compiled `.wasm` file to the FastEdge binary store. The API automatically detects the binary type from the file contents.</p>

    ```bash theme={null}
    curl -X POST https://api.gcore.com/fastedge/v1/binaries/raw \
      -H "Authorization: APIKey $GCORE_API_KEY" \
      -H "Content-Type: application/octet-stream" \
      --data-binary @app.wasm
    ```

    <p>The response includes the binary ID used in the next step:</p>

    ```json theme={null}
    {
      "id": 12345,
      "api_type": "proxy-wasm"
    }
    ```

    <p>To deploy from the predefined JWT template instead, list available templates with <code>GET [https://api.gcore.com/fastedge/v1/template](https://api.gcore.com/fastedge/v1/template)</code>, note the template's `binary` field, and use that binary ID in Step 2.</p>

    ## Step 2. Create a FastEdge application

    <p>Create the application using the binary ID from Step 1. Set `status` to `1` to activate the application immediately.</p>

    ```bash theme={null}
    curl -X POST https://api.gcore.com/fastedge/v1/apps \
      -H "Authorization: APIKey $GCORE_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "name": "my-cdn-app",
        "binary": 12345,
        "status": 1,
        "env": {
          "MY_VARIABLE": "value"
        }
      }'
    ```

    <p>The response includes the application ID (`id`), which is needed to configure the CDN resource:</p>

    ```json theme={null}
    {
      "id": 67890,
      "name": "my-cdn-app",
      "status": 1,
      "api_type": "proxy-wasm"
    }
    ```

    ## Step 3. Enable FastEdge for your CDN resource

    <p>Update the CDN resource to route traffic through the FastEdge application. The `fastedge` option accepts five trigger stages — configure the ones the application handles.</p>

    ```bash theme={null}
    curl -X PATCH https://api.gcore.com/cdn/resources/RESOURCE_ID \
      -H "Authorization: APIKey $GCORE_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "options": {
          "fastedge": {
            "enabled": true,
            "on_request_headers": {
              "app_id": "67890",
              "enabled": true,
              "interrupt_on_error": true
            }
          }
        }
      }'
    ```

    <p>Replace `RESOURCE_ID` with the CDN resource ID. The `interrupt_on_error` field controls behavior on error: `true` returns the FastEdge error to the client, `false` forwards the request to the origin. For security-sensitive applications, set it to `true`.</p>

    <p>To apply FastEdge only to specific URL paths, create a CDN rule with <code>POST [https://api.gcore.com/cdn/resources/RESOURCE\_ID/rules](https://api.gcore.com/cdn/resources/RESOURCE_ID/rules)</code> and include the `fastedge` option in the rule's `options` object.</p>

    ## Disable FastEdge integration

    <p>Set `fastedge.enabled` to `false` to stop FastEdge processing on a CDN resource:</p>

    ```bash theme={null}
    curl -X PATCH https://api.gcore.com/cdn/resources/RESOURCE_ID \
      -H "Authorization: APIKey $GCORE_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "options": {
          "fastedge": {
            "enabled": false
          }
        }
      }'
    ```

    ## Delete a CDN application

    <Info>
      An enabled FastEdge application linked to a CDN resource cannot be deleted. Disable the FastEdge integration on the CDN resource before deleting the application.
    </Info>

    ```bash theme={null}
    curl -X DELETE https://api.gcore.com/fastedge/v1/apps/APP_ID \
      -H "Authorization: APIKey $GCORE_API_KEY"
    ```

    <p>A `204 No Content` response confirms the application was deleted.</p>
  </MethodSection>
</MethodSwitch>
