diff --git a/Readme.md b/Readme.md new file mode 100644 index 0000000..93e0764 --- /dev/null +++ b/Readme.md @@ -0,0 +1,38 @@ +# DomainRedirect + +This is a simple http redirect service. It is designed to be used with a domain that is not the primary domain for a website. For example, if you have a website at `example.com` and you want to redirect `example.net` to `example.com`, you can use this service. + +### Features +- Redirects all requests other than /health to whatever is specified in the `REDIRECT_TARGET` environment variable. +- Health check endpoint at `/health` that returns a 200 status code. + +### Limitations +- Paths are not preserved. For example, if a user goes to `example.net/foo`, they will be redirected to the `REDIRECT_TARGET` such as `example.com`. + +## Usage + +This is not compatible with Node or Deno. It is written to be run with [Bun](https://bun.sh/) + +### Run with Bun + +```bash +REDIRECT_TARGET="https://example.com/" bun run index.js +``` + +### Run with Docker + +1. Build the image +```bash +docker build -t domainredirect . +``` + +2. Run the image +```bash +docker run -p 8080:8080 -e REDIRECT_TARGET="https://example.com/" domainredirect +``` + +> Note: If you are building on Apple Silicon and deploying to x86 like me, you will need to build for a [different platform](https://docs.docker.com/build/architecture/) + +### Run with Nomad on Docker + +Check out my [homelab implementation](https://git.cbraaten.dev/Caleb/Homelab/src/branch/main/nomad_jobs/services/domainredirect).