A simple NGINX that redirects all traffic to a given URL. It is meant to be run behind a reverse proxy and redirect old/unused (Sub-)Domains.
Configuration is kept extremly simple, all you need to do is adding up to four environmental vars in your docker-command, docker-compose-file or how ever you want to start it.
Var | Meaning | Example |
---|---|---|
dest | The url all traffic should go to, write only the base domain (https://a.bc.de) if you use keep_uri | dest=https://github.com/cryptkid/docker-redirector" |
access_log | The file to write an access-log to. Default: off" | access_log=/var/log/access.log |
keep_uri | Keep request uri, redirect from a.example.com/bla to b.example.com/bla and not to b.example.com | keep_uri=true |
acme_404 | Return 404 to all requests to acme-challenges in order to prevent issues with reverse proxies | acme_404=true |
Redirect all queries to this repo:
docker run -e dest='https://github.com/cryptkid/docker-redirector' -e access_log='off' -e keep_uri='false' -it cryptkiddie2/redirector:latest
Redirect to b.example.com keeping the requested uri (a.example.com/bla -> b.example.com/bla)
docker run -e dest='https://b.example.com' -e access_log='off' -e keep_uri='true' -it cryptkiddie2/redirector:latest
There is an an example docker-compose.yml
-
Allow multiple redirects for different sources in one container
-
https not supported (does not matter in my case because I run it behind traefik
If there was anybody out there wanting to help, he/she/it could work on this and open a PR