vanityURLs is a simple solution to deploy a budget-friendly Url Shortener. It runs at scale in your Cloudflare subscription with continuous integration.
If you don't own an a Cloudflare subscription already, you can create your free account today so you can experience everything without spending a dime.
Features:
- Fully branded internet domain using Cloudflare's DNS & Pages so your links are compact and pretty
- URL redirection (301, 302, 303, 307 and 308)
- Advanced redirection with splats (e.g., /news/* → /blog/:splat )
- Continuous integration managed by Cloudflare Page Engine
My objective is to work at the command line and automate it. So feel free to fork, and customize.
You’ve been there too, a fully branded short URLs is useful but your low volume does not justify a commercial solution. Furthermore, links generated by a free solution will eventually expire and they're not privacy friendly.
This kind of solution is known as TinyURL, tiny url, shorten that long URL, URL Shortening Service, goo.gl, bit.ly, short.io, etc.
As long as you secure your Github and Cloudflare accounts with robust authentication, there is not much that can go wrong with such simple solution. It use the products as designed, there is no hack involved.
Refer to how does it work for more information.
- Register a tiny internet domain name with your preferred vendor
- Add the domain to Cloudflare DNS
- Fork the repository, you just need the
main
branch - Create a project underneath Cloudflare Workers & Pages
- Connect the repository
- Configure your deployment and build setup:
- Framework preset: none
- Build command: none
- Build output directory: /build
- Open the xyz.page.dev in your browser, you should be redirected to https://BHDicaire.com based on the current configuration
- Setup a custom domain for your page project
- Configure the DNS entry via Cloudflare DNS
- Open the defined DNS entry in your browser, you should be redirected to https://BHDicaire.com based on the current configuration
- Update the header configuration
- Change
https://xyz.pages.dev/*
→ to your cloudflare's specfic page URL - Change
https://example.com/*
→ to your tiny internet domain name
- Change
- Update the redirection list
- Add and commit the change to the github repository
- Cloudflare will detect the change and initiate a deployment
You can use the following Bash scripts
, if this is your cup of tea. Refer to the documentation.
Name | Description |
---|---|
bin/lnk |
Generate a custom ID for a new URL, git add + commit |
bin/tinylnk |
Generate a unique ID for a new URL, git add + commit |
Contributions are welcome! We recognize all types based on the all-contributors specification. Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.
Benoît H. Dicaire 💻 📖 🛡️ |
Félix Léger 🤔 📓 📣 |
- dnsConfiguration – Automated DNS configuration with StackOverflow's DNSControl and Git
vanityURLs is Copyright 2023 Benoît H. Dicaire and licensed under the MIT licence.