Digital marketing use cases for Cloudflare serverless workers include:
- Custom URL and specific country redirects.
- Middleware between services.
- API request caching.
To learn more about use cases have a read of Cloudflare serverless worker examples.
In practice to setup a Cloudflare serverless worker you will need the following:
- Cloudflare account with serverless workers enabled.
- A serverless worker script loaded.
- If required a subdomain or path on your DNS for the serverless worker endpoint. Note if using a subdomain then you will need to setup a corresponding "A" record pointing to a dummy IP (e.g. 192.0.2.1).
In the case of using a script like the example for bulk redirects ensure that the path that you map your worker to has the required wildcards. Also note that with this script you may not need to change the path with a split.
A typical Cloudflare serverless worker process flow with hidden environment variables:
- Access data and/or content via an APIs where secure environment variables are required.
- Apply some caching on Cloudflare so that you don't have to hit the API origin server and potentially get rate limited.
- Apply some functions to the data.
- Trigger some other API to do something important and exciting, again potentially where secure environment variables are required.
- Then, expose the result via an API all to be consumed in a website via JQuery.
Finally, what is really exciting about Cloudflare serverless workers is that they are relatively inexpensive when compared to dedicated API hosting and much easier to setup than an AWS Lambda function.
Help make an awesome list
Share a comment about a Cloudflare serverless worker digital marketing use case.