The purpose of the Cloudflare CDN Worker client side implementation is to inject the Arkose client side scripts into the HTML on a page such as Login or Registration. There are 2 versions available on the Github page, one for a Button trigger and the other for a Form Submission trigger. Both versions will store a Cookie containing the Arkose Token which can then be verified using a second worker.
Log in to your Cloudflare account.
Navigate to the Workers & Pages section in the side navigation panel and select Overview.
- After the page loads, click on the Create Application button.
- Select the Workers tab and click on Create Worker.
- Provide a name for the worker, then select Deploy.
- The Worker has been created, the next step is editing workers code.
- After deploying the Worker, click on Edit Code.
- Delete the sample code from the
- Open button-takeover or form-submit-takeover depending if using a Button trigger or a Form trigger. Copy and paste the code into the
- Click on Save and deploy
- Navigate to the Workers summary and select the Settings tab.
- Select the Variables menu item from the side navigation panel.
Add the following parameters as Worker Variables.
Variable Description Sample
Arkose labs private key obtained through https://portal.arkoselabs.com 11111111-1111-1111-1111-111111111111
The number of retries to perform when there is an error 2
The name of the cookie that the Arkose token will be stored in arkose-Token
The name of the cookie that an Arkose error will be stored in arkoseError
The length of time the Arkose cookies should be active for (in milliseconds) 300000 (5 minutes)
The number of times to retry verification if there is an error # submitButton
The querySelector string used for selecting the required form to protect # submitForm
Click Save and deploy.
- Navigate to the Worker page and select the Triggers tab.
- Click on Add route.
- Enter the route name (no https is needed). This is the URL of the page containing the Login or Registration form.
- Select the domain Zone from the dropdown menu.
- Click on Add route.
- Once the route is added, the setup has been completed.
Updated 3 months ago