Cloudflare Worker for Redirects
A simple Cloudflare Worker for redirecting requests.
Prerequisite
Since the codebase is written in Rust, you'll need to install Rust to build the worker.
Wrangler 2 is also required to develop and deploy this project. Do not confuse it with the older version.
Development
Cloudflare Workers is a closed-source SAAS offering. The closest thing we can get for local development is miniflare. To start, install it with npm
(do NOT install with yarn
until this issue resolves) with:
$ npm install -g miniflare
Then, build the worker:
$ wrangler publish --dry-run
Finally, run the compiled worker with miniflare
with the script provided:
$ ./dev.sh
The local worker instance should expose the service on port 8787
, which can be customized via the --port
flag.
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.