xJonathanLEI / redirect-worker

A simple Cloudflare Worker for sending 301 responses

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

at your option.

About

A simple Cloudflare Worker for sending 301 responses

License:Apache License 2.0


Languages

Language:Rust 87.3%Language:Shell 12.7%