Skip to content

非公式本サイトは非公式の日本語ドキュメントであり、Cloudflare 公式サイトではありません。最新情報はdevelopers.cloudflare.comをご確認ください。

Bot Management の情報をオリジンへ送る

オリジンへ Bots の情報を送ります。利用できるフィールドの一覧は Bot Management variables を参照してください。

最終更新 Markdown で表示Agent セットアップ
export default {
	async fetch(request) {
		// Clone the original request to construct a new request
		const newRequest = new Request(request);
		// Set Bot Management headers on a new request to the origin: https://developers.cloudflare.com/bots/reference/bot-management-variables/#workers-variables
		newRequest.headers.set("bot-score", request.cf.botManagement.score); // bot score (integer)
		newRequest.headers.set(
			"verified-bot",
			request.cf.botManagement.verifiedBot,
		); // verified bot (boolean)
		newRequest.headers.set("ja4", request.cf.botManagement.ja4); // JA4 fingerprint hash (string)
		// Serve response to the new request from the origin
		return await fetch(newRequest);
	},
};

役に立ちましたか?