Router protection with OAC
Creates a router with Origin Access Control (OAC) to secure Lambda function URLs behind CloudFront. Direct access to the Lambda URL returns 403.
const router = new sst.aws.Router("MyRouter", { protection: "oac",});
const api = new sst.aws.Function("MyApi", { handler: "api.handler", url: { router: { instance: router, path: "/api" }, },});export const handler = async (event: any) => { return { statusCode: 200, headers: { "Content-Type": "application/json", }, body: JSON.stringify(event.headers), };};View the full example.