Docker-Web-Redirect: A Versatile Tool for Redirecting Web Traffic

In the dynamic world of the internet, there are often instances where you need to redirect web traffic from one domain or URL to another. This could be due to domain changes, website maintenance, or simply wanting to consolidate traffic under a single domain. Docker-Web-Redirect is a lightweight and easy-to-use Docker container that allows you to achieve this task seamlessly.

Key Features:

  • Lightweight and Efficient: Docker-Web-Redirect utilizes the power of Nginx, a leading web server, while maintaining a lightweight footprint, consuming only ~2 MB of RAM on Linux.
  • Path Retention: Preserves the original URL path and GET parameters during redirection, ensuring seamless navigation for users.
  • Permanent Redirects: Enforces permanent redirects (HTTP status code 301), making the change persistent and recognized by search engines.
  • Image Size Optimization: Weighs in at a mere ~25 MB, making it an economical and efficient solution for redirect tasks.

Application Scenarios:

  • Domain Migration: Migrate user traffic from an old domain to a new one seamlessly, ensuring a smooth transition for visitors.
  • Website Maintenance: Temporarily redirect traffic during website maintenance to inform users and avoid downtime.
  • URL Consolidation: Combine multiple URLs under a single domain, simplifying navigation and search engine optimization.
  • Third-Party Integration: Redirect traffic from external links to your domain, enhancing brand recognition and driving traffic.

Usage:

For this to work you need docker installed on your machine, you can se the tutorial for installing docker for windows/macos here or for linux here.

Clone the project from the Github

git clone https://github.com/Arbarwings/docker-web-redirect.git

Enter in the docker folder

cd docker-web-redirect

Docker Compose: Utilize Docker Compose to orchestrate multiple containers, including the redirector. For instance, to redirect all traffic to mydomain.com

version: '3'
services:
  redirect:
    image: arbarwings/docker-web-redirect
    restart: always
    environment:
      - REDIRECT_TARGET=mydomain.com

Run the docker compose file with:

docker compose up -d

Using without docker-compose

Docker Run: Launch the Docker container using the following command:

docker run --rm -d -e REDIRECT_TARGET=mydomain.com -p 80:80 arbarwings/docker-web-redirect

Conclusion:

Docker-Web-Redirect proves to be a valuable tool for managing web traffic redirections. Its lightweight nature, efficient operation, and versatile features make it a practical choice for a wide range of use cases. Whether you’re migrating domains, conducting website maintenance, or consolidating traffic under a single umbrella, Docker-Web-Redirect streamlines the process and ensures a seamless user experience.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top