Skip to content

A cloudflare worker to add a lock to any website!

Notifications You must be signed in to change notification settings

unlock-protocol/cloudflare-worker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

👷 A Cloudflare Worker to lock 🔓 a webpage

A Cloudflare woekr which lets website owners easily deploy an access control layer for monetization with Unlock.

You can try it out by going to https://token-gated.com/ which is token gated an requires ownership of a membership (it is using the Rinkeby test network, so you don't need to spend real money).

How to

Clone the repo:

git clone git@github.com:unlock-protocol/cloudflare-worker.git

Configure worker

Update its .src/config.js file to match your needs. Importantly, you need to keep the pessimistic mode to be true .

Install dependencies

yarn

Push to cloudflare

yarn wrangler publish

(You will likely be prompted to login to CloudFlare first)

Configure website

Now that the worker is deployed, you need to link it to your CloudFlare sites. Your mileage may vary but here is howe we did it for https://token-gated.com. From the Cloudflare Dashboard, select your website, in the left column, click on "Workers". Click the Add Route button. Enter the route(s) you want to "token-gate". In the Service select, pick the unlock-cloudflare-worker and select the environment of choice. Hit Save. You're all set!

Screen Recording 2022-02-05 at 05 38 31 PM

Contributing

You are encouraged to open pull-requests and help us improve this worker!

About

A cloudflare worker to add a lock to any website!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published