A redirection tool, just like aka.ms
.
Assuming the redirection tool is deployed under domain contoso.com
.
In wrangler.toml
, we are routing requests to https://contoso.com/*
or https://aka.contoso.com/*
to this tool.
Assuming you have a rule of redirecting /msft
to https://finance.yahoo.com/quote/MSFT
. So, when users are navigating to https://contoso.com/msft
or https://aka.contoso.com/msft
, they will get a HTTP response with status 302 to https://finance.yahoo.com/quote/MSFT
.
- If you don't have a Cloudflare account, create one.
- Go to Cloudflare Profile - API Token and create a API token with these permissions:
- Workers KV Storage:Read
- Workers Scripts:Edit
- Account Settings:Read
- Workers Routes:Edit
- User Details:Read
- Put the value of Cloudflare API Token in GitHub Actions Secret with name
CF_API_TOKEN
- Go to Cloudflare Workers KV, and add a KV Namespace for this tool, copy the namespace ID and put it in GitHub Actions Secret with name
CF_KV_NAMESPACE
. - If you are using a private repository, go to Codecov, activate this repository (or your forked repository) and copy Repository Upload Token, then put the value of that token in GitHub Actions Secret with name
CODECOV_TOKEN
. - Add these GitHub Actions secrets:
CF_ACCOUNT_ID
: Your Cloudflare account IDCF_ZONE_ID
: Zone ID on Cloudflare that you'll be deploying toCF_DOMAIN
: Your domain name, such ascontoso.com
CF_KV_NAMESPACE
: Your Cloudflare Workers KV Namespace ID
- Add DNS records:
- An AAAA record for
@
(contoso.com.
) to100::
and proxy through Cloudflare - An AAAA record for
aka
(aka.contoso.com.
) to100::
and proxy through Cloudflare
- Run GitHub Actions workflow in this repository, now this tool should be deployed to your Cloudflare account.
- Add rules in Cloudflare Workers KV Namespace you just created.
- The key is the request path, leading with a slash, such as
/
,/test
. - The value is the URL that users will be redirected to, should be a absolute URL. Relative URLs are also accepted but you should use relative URLs with caution.
See LICENSE.