Whitelist path based lambda routing

Hi,

I have a CDN which acts as a proxy in case the file is not found in cache, forwards the request to API Gateway and then to a lambda function to retrieve the file from S3.

I was wondering what’s the best way to allow access only to certain url paths? The whitelist should be dynamic.

For example:
cdn.domain.sh/PATH_TO_ALLOW/carbon.png

Solutions:
Custom API Gateway authoriser?