1.3 KiB
		
	
	
	
	
	
	
	
			
		
		
	
	
			1.3 KiB
		
	
	
	
	
	
	
	
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_TARGETenvironment variable. - Health check endpoint at 
/healththat 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 theREDIRECT_TARGETsuch asexample.com. 
Usage
This is not compatible with Node or Deno. It is written to be run with Bun
Run with Bun
REDIRECT_TARGET="https://example.com/" bun run index.js
Run with Docker
- Build the image
 
docker build -t domainredirect .
- Run the image
 
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
Run with Nomad on Docker
Check out my homelab implementation.