Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/GitbookIO/proxies-on-cloudflare
Proxies in Cloudflare Workers
https://github.com/GitbookIO/proxies-on-cloudflare
cloudflare-worker firebase firebase-hosting
Last synced: 2 months ago
JSON representation
Proxies in Cloudflare Workers
- Host: GitHub
- URL: https://github.com/GitbookIO/proxies-on-cloudflare
- Owner: GitbookIO
- Created: 2018-10-19T13:41:18.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-07-12T02:41:11.000Z (over 1 year ago)
- Last Synced: 2024-08-01T16:34:50.705Z (5 months ago)
- Topics: cloudflare-worker, firebase, firebase-hosting
- Language: TypeScript
- Homepage:
- Size: 473 KB
- Stars: 92
- Watchers: 7
- Forks: 10
- Open Issues: 36
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-cloudflare - Proxies - Makes it easy to build workers, by providing high-level proxying primitives addressing common needs. (Workers / Recipes)
- awesome - GitbookIO/proxies-on-cloudflare - Proxies in Cloudflare Workers (TypeScript)
- awesome-cloudflare - Proxies - Makes it easy to build workers, by providing high-level proxying primitives addressing common needs. (Workers / Recipes)
README
# `proxies-on-cloudflare`
Makes it easy to build [Cloudflare Workers](https://www.cloudflare.com/products/cloudflare-workers/), by providing high-level proxying primitives addressing common needs.
## Installation
```
$ yarn add proxies-on-cloudflare
```## Features
- Built-in proxies for
- Firebase (Hosting & CloudFunctions)
- Mixpanel
- Simple routing via `quoi` (providing a familiar `express`-like API)
- One-liner proxies (e.g: `proxy.to('https://upstream.com/')`)
- Loadbalancing (`roundrobin`, `random`, `iphash`, ...)
- Fallback and error handling## Example
```js
import { quoi, firebase, proxy } from 'proxies-on-cloudflare';
import { hosting as hostingConfig } from './firebase.json';// Init firebase proxy
const fbase = new firebase('gitbook-staging', hostingConfig);// Route and listen
const app = quoi();
app.domain('app.gitbook.com').serve(fbase);
app.domain('test.gitbook.com').serve(proxy.to('https://test.github.io/test/'));
app.domain('storage.gitbook.com').serve(proxy.roundrobin(['https://server1', /* ... */ ]));
app.listen();
```You can see a more complex (real-world) example in `_examples/gitbook/`
## Why ?
We originally (GitBook) built `proxies-on-cloudflare` (previously named `firebase-on-cloudflare`) to fix connection issues we had between `Cloudflare` and `Fastly/Firebase Hosting` but have now extended it to solve broad routing needs.