This Docker container exposes port 80 and redirects all web traffic to the given target domain/URL.
The target domain/URL is set by the REDIRECT_TARGET environment variable.
The redirect type is set by the REDIRECT_STATUS environment variable (defaults to 301, may be set to 301 or 302 or transparent only).
You could enable stub_status page by setting ENABLE_STATUS_PAGE to 1.
Possible redirect targets include domains (<NEW_DOMAIN.COM>), paths (<NEW_DOMAIN.COM>/my_page) or specific protocols (https://<NEW_DOMAIN.COM>/my_page).
Example: $ docker run --rm -d -e REDIRECT_TARGET=<NEW_DOMAIN.COM> -p 80:80 rkcreation/web-redirect
The URL path and GET parameters are retained. That means that a request to http://<OLD_DOMAIN.COM>/index.php?page=2 will be redirected to http://<NEW_DOMAIN.COM>/index.php?page=2 when REDIRECT_TARGET=<NEW_DOMAIN.COM> is set.
Redirects could be :
REDIRECT_STATUS=301 (or not set) : permanent redirect (HTTP status code 301). That means browsers will cache the redirect and will go directly to the new site on further requests. Also search engines will recognize the new domain and change their URLs.REDIRECT_STATUS=302 : temporary redirect (HTTP status code 302).REDIRECT_STATUS=transparent : transparent redirect (with nginx proxy_pass directive).This image can be combined with the jwilder nginx-proxy. A sample docker-compose file that redirects <OLD_DOMAIN.COM> to <NEW_DOMAIN.COM> could look like this:
version: '3'
services:
redirect:
image: rkcreation/web-redirect:latest
restart: always
environment:
- VIRTUAL_HOST=<OLD_DOMAIN.COM>
- REDIRECT_TARGET=<NEW_DOMAIN.COM>
- REDIRECT_STATUS=301
This image can be combined with traefik proxy. A sample docker-compose file that redirects <OLD_DOMAIN.COM> to <NEW_DOMAIN.COM> could look like this:
version: '3'
services:
redirect:
image: rkcreation/web-redirect:latest
restart: always
environment:
- REDIRECT_TARGET=<NEW_DOMAIN.COM>
- REDIRECT_STATUS=301
labels:
- "traefik.frontend.rule=Host:<OLD_DOMAIN.COM>;"
Versions 1.1.x provides Redirect target, status (301 / 302 / transparent) and nginx_status path.
Versions 1.0.x provides Redirect target and status (301 / 302).
Content type
Image
Digest
Size
8.9 MB
Last updated
almost 7 years ago
docker pull rkcreation/web-redirect