Skip to content

Return information about the incoming request

Respond with information about the incoming request provided by Cloudflare’s global network.

export default {
async fetch(request) {
// For any request, respond with JSON object containing all incoming request properties provided by Cloudflare network
return Response.json(request.cf, {
// Add new header to identify request was served by Snippets
headers: {
"x-snippets-hello": "Hello from Cloudflare Snippets",
},
});
},
};