Skip to content

Conversation

@TartanLlama
Copy link
Contributor

Adds support for shielding. Example:

/// <reference types="@fastly/js-compute" />
    
import { Shield } from "fastly:shielding";

async function app(event) {
    const shield = new Shield('wsi-australia-au');
    // If running on the shield POP, fetch from the origin directly
    if (shield.runningOn()) {
        return await fetch('https://http-me.fastly.com/anything', { backend: 'httpme' });
    }
    // Otherwise, route the request through the shield using an encrypted connection
    return await fetch(event.request, { backend: shield.encryptedBackend() });
}

addEventListener("fetch", (event) => event.respondWith(app(event)))

@TartanLlama TartanLlama changed the title Shielding support feat: Shielding support Dec 2, 2025
@TartanLlama TartanLlama requested a review from zkat December 2, 2025 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants