Pular para o conteúdo

Send suspect bots to a honeypot

Use the bot score field to send bots to a honeypot.

Atualizado em Ver como Markdown
export default {
	async fetch(request) {
		const response = await fetch(request);

		// Clone the response so that it is no longer immutable
		const newResponse = new Response(response.body, response);

		if (request.cf.botManagement.score < 30) {
			const honeypot = "https://example.com/";
			return await fetch(honeypot, request);
		} else {
			return newResponse;
		}
	},
};