Sign inSign up

moonbuggy2000/url-redirector

By moonbuggy2000

Updated almost 2 years ago

Nginx URL redirection configurable from ENV

Image
0

1.1K

moonbuggy2000/url-redirector repository overview

Docker URL Redirector

An Nginx container with URL redirections configured based on a container environment variable.

Combining this with Traefik and Docker Dnsmasq Updater, we can override the DNS lookup for a public site we want to redirect, point it to this container and then redirect it to where we want to go.

Container Environment

  • REDIRECTS - a space separated list of <domain>,<redirect> strings
  • TZ - set timezone

An example of REDIRECTS, forcing the use of geo-specific domains:

REDIRECTS="google.com,google.com.au ebay.com,ebay.com.au"
docker-compose.yml
version: '3.8'

services:
  url-redirector:
    image: moonbuggy2000/url-redirector:latest
    container_name: url-redirector
    hostname: url-redirector
    domainname: url-redirector.moon
    restart: unless-stopped
    environment:
      - "TZ=Australia/Sydney"
      - "REDIRECTS=<domain_1>,<redirect_1> <domain_2>,<redirect_2>"
    labels:
      - "traefik.enable=true"
      - "traefik.docker.network=traefik"
      - "traefik.http.routers.url-redirector.rule=Host(`domain_1`) || Host(`domain_2`)"
    networks:
      - traefik

networks:
  traefik:
    name: traefik

GitHub: https://github.com/moonbuggy/docker-url-redirector

Docker Hub: https://hub.docker.com/r/moonbuggy2000/url-redirector

Tag summary

Content type

Image

Digest

sha256:b318987fa

Size

7.7 MB

Last updated

almost 2 years ago

docker pull moonbuggy2000/url-redirector