Skip to content

JonasDoesThings/cf-workers-url-redirect-resolver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cf-workers-url-redirect-resolver

A dead-simple cloudflare worker for resolving URL redirects.
It does not perform any caching or whatsoever.
If the passed URL has no protocol, https:// will be prepended.

Setup

Set the environment variable ACCEPTED_API_TOKENS to a list of accepted Bearer Tokens seperated by spaces.

e.g. ACCEPTED_API_TOKENS="token1 token2 token3"

Dev

Run the project locally using yarn start --local --var ACCEPTED_API_TOKENS:justtesting

Usage

GET <worker url>/?target=[url to resolve]
Send one of the configured API Tokens as a Bearer Token in the Authorization header.

Example

HTTPIE: http -A bearer -a justtesting "http://localhost:8787/?target=https://amzn.to"
CURL: curl -H "Authorization: Bearer justtesting" "http://localhost:8787/?target=https://amzn.to"

License

This work is licensed under the CC-0 (No Rights Reserved) License.
Do what you want, I'm not liable for anything you do with this code.

About

URL Redirect Resolver using Cloudflare Workers

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published