An open API service indexing awesome lists of open source software.

https://github.com/jonasdoesthings/cf-workers-url-redirect-resolver

URL Redirect Resolver using Cloudflare Workers
https://github.com/jonasdoesthings/cf-workers-url-redirect-resolver

cf-workers cloudflare-worker cloudflare-workers serverless

Last synced: 5 months ago
JSON representation

URL Redirect Resolver using Cloudflare Workers

Awesome Lists containing this project

README

        

# 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 `/?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](https://creativecommons.org/share-your-work/public-domain/cc0/).
Do what you want, I'm not liable for anything you do with this code.