Last active
July 15, 2024 22:03
-
-
Save milksense/afb9a5022a66cfccfc33f1653faf6629 to your computer and use it in GitHub Desktop.
Simple Cloudflare Ray ID generator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import randomstring from 'randomstring'; | |
/** | |
* A Cloudflare Ray ID is a unique identifier given to every request that goes through Cloudflare. | |
* | |
* @see https://developers.cloudflare.com/fundamentals/get-started/reference/cloudflare-ray-id/ | |
* | |
* @returns {string} "Cloudflare" Ray ID. | |
*/ | |
export default (): string => { | |
const prefix: string = randomstring.generate({ length: 16, charset: 'hex' }); | |
const difficulty: number = 13; // or smth else | |
return `Ray ID: ${prefix}-${difficulty}`; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
cf-ray isn't random, just a timestamp.