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'));
});