Skip to main content
Version: 3.32.1

Acl.prototype.lookup()

The lookup(ipAddress) method returns the name associated with the Acl instance.

Syntax

acl.lookup(ipAddress)

Parameters

  • ipAddress : string
    • IPv4 or IPv6 address to lookup

Return value

An Object of the form { action: 'ALLOW' | 'BlOCK', prefix: string }, where prefix is the IP address prefix that was matched in the ACL.

Example

/// <reference types="@fastly/js-compute" />
import { Acl } from 'fastly:acl';
addEventListener('fetch', async (evt) => {
const myAcl = Acl.open('myacl');
const { action, prefix } = await myAcl.lookup(evt.client.address);
evt.respondWith(new Response(action === 'BLOCK' ? 'blocked' : 'allowed'));
});