Skip to content

Caching Serverless Proxy for Externally Hosted Site using Cloudflare Worker

Notifications You must be signed in to change notification settings

adamchasetaylor/cf-worker-proxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

serverless-cf-worker-proxy

Caching Serverless Proxy for Serverless Functions using Cloudflare Worker

You can use this to use your own custom domain with Serverless Function

It also provides caching which can be nifty if you are using Serverless Assets

Example using Serverless Video App

  1. Setup your Serverelss Function (I'm using Twilio's free Video App here)

https://www.twilio.com/blog/open-source-video-apps-reactjs-ios-android

  1. Setup up your a Cloudflare Worker

Environment Variables Envrionment Variables

  • ORIGIN: hostname of external host
  • PROTOCOL: https or http

Copy the code from index.js into a new worker. This can be done using the Cloudflare GUI or using Wrangler.

  1. Add a route to your worker so that it can answer requests on your domain hosted on cloudflare

Route

  1. As long as the proxy status of the subdomain or domain is set to "Proxied" using cloudflare, the worker will respond to all requests and proxy them to your Serverless Functions & Assets. Cloudflare will also serve as a super-fast georedundant CDN for your assets.

  2. Use your function with your own domain

VideoApp

About

Caching Serverless Proxy for Externally Hosted Site using Cloudflare Worker

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages