x-custom-token request header. If the value is token-123456, access is allowed. Otherwise, access is denied.async function handleRequest(request) {const token = request.headers.get('x-custom-token');if (token === 'token-123456') {return new Response('hello world');}// Incorrect key supplied. Reject the request.return new Response('Sorry, you have supplied an invalid token.', {status: 403,});}addEventListener('fetch', event => {event.respondWith(handleRequest(event.request));});


Was this page helpful?
You can also Contact sales or Submit a Ticket for help.
Help us improve! Rate your documentation experience in 5 mins.
Feedback