redirector/README.md

52 lines
1 KiB
Markdown
Raw Normal View History

2023-07-07 08:24:11 +02:00
# Redirector
Simple redirection service.
Runs on Node and uses [Hono](https://hono.dev).
Can be adapted to run on Bun, Cloudflare Workers, or any other serverless platform.
Available as a [Docker image](https://hub.docker.com/r/nzambello/redirector).
## Usage
2023-07-07 08:15:37 +02:00
```
2023-07-07 08:24:11 +02:00
yarn install
REDIRECT_URL=https://nzambello.dev PERMANENT=true yarn start
2023-07-07 08:15:37 +02:00
```
2023-07-07 08:24:11 +02:00
Then, open http://localhost:7878/ in your browser.
```
open http://localhost:7878
2023-07-07 08:15:37 +02:00
```
2023-07-07 08:24:11 +02:00
and you will be redirected to `REDIRECT_URL` from your env.
2023-07-07 08:25:39 +02:00
### Configuration
2023-07-07 08:24:11 +02:00
It loads configuration from environment variables:
2023-07-07 08:25:39 +02:00
- `REDIRECT_URL`: (**required**) the url to redirect to
2023-07-07 08:24:11 +02:00
- `PERMANENT`: if true, it will return a 301 status code, otherwise 302
2023-07-07 08:25:39 +02:00
## Docker example
```
docker run -p 7878:7878 -e REDIRECT_URL=https://nzambello.dev -e PERMANENT=true nzambello/redirector:latest
```
2023-07-07 08:24:11 +02:00
## Docker compose example
```yaml
version: "3.8"
services:
redirector:
image: nzambello/redirector:latest
environment:
- REDIRECT_URL=https://nzambello.dev
- PERMANENT=true
ports:
- 7878:7878
2023-07-07 08:15:37 +02:00
```