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
- Host: GitHub
- URL: https://github.com/jonasdoesthings/cf-workers-url-redirect-resolver
- Owner: JonasDoesThings
- Created: 2023-02-11T20:44:00.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-07-09T17:46:50.000Z (10 months ago)
- Last Synced: 2024-07-09T22:23:32.702Z (10 months ago)
- Topics: cf-workers, cloudflare-worker, cloudflare-workers, serverless
- Language: TypeScript
- Homepage:
- Size: 254 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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.