URL shortening is a technique on the World Wide Web in which a Uniform Resource Locator may be made substantially shorter and still direct to the required page. This is achieved by using a redirect which links to the web page that has a long URL.
docker run --name shortener -d alirn76/url-shortener:latest
The instance starts at port 8000, so you can publish it in any port you want.
Default is 2
The instance starts with how many workers?
Default is http://127.0.0.1:8000
Usage:
-
- Show the Shortened URL for copy
-
- Check the Original URL if
PRIVATE
istrue
- Check the Original URL if
Default is false
Check the BASE_URL
in Original URL
It won't work correctly if
BASE_URL
is ip
example:
BASE_URL
= https://alirn.ir
Original URL
= https://google.com/something/ -->Not Valid
Original URL
= https://alirn.ir/something -->OK
Original URL
= http://alirn.ir/something -->OK
Original URL
= https://api.alirn.ir/something -->OK
Original URL
= https://alirn.ir.google.com/ -->Not Valid
Default is "URL Shortener"
Used to show the Title of page (you can put your website name in it)
Default is "Create Short & Memorable URL In a Seconds."
docker run --name shortener --restart always -p 80:8000 -e WORKER=1 -e BASE_URL=https://example.com -e PRIVATE=true -e TITLE="URL Shortener" -e DESCRIPTION="Create Your Short URL Here" -d alirn76/url-shortener:latest
Known Issue: You'll get 5xx error if you don't create a docker volume.
-
- Create docker volume →
docker volume create shortener-volume
- Create docker volume →
-
- Add volume to you run command →
--volume shortener-volume:/shortener/database
- Add volume to you run command →
Docker Image → https://hub.docker.com/r/alirn76/url-shortener
Thanks to MohammadReza Shahbazi for Frontend