34 lines
960 B
YAML
34 lines
960 B
YAML
services:
|
|
# Example 1: Simple domain redirect (301 Permanent Redirect)
|
|
redirect-example:
|
|
image: redirect:latest
|
|
container_name: redirect-example
|
|
ports:
|
|
- "8081:8080"
|
|
environment:
|
|
- REDIRECT_TARGET=https://example.com
|
|
- REDIRECT_CODE=301
|
|
restart: unless-stopped
|
|
|
|
# Example 2: Redirect preserving full request path and query string (302 Temporary Redirect)
|
|
redirect-with-path:
|
|
image: redirect:latest
|
|
container_name: redirect-with-path
|
|
ports:
|
|
- "8082:8080"
|
|
environment:
|
|
- REDIRECT_TARGET=https://newsite.com$request_uri
|
|
- REDIRECT_CODE=302
|
|
restart: unless-stopped
|
|
|
|
# Example 3: Redirect to a specific subpath (307 Temporary Redirect)
|
|
redirect-subpath:
|
|
image: redirect:latest
|
|
container_name: redirect-subpath
|
|
ports:
|
|
- "8083:8080"
|
|
environment:
|
|
- REDIRECT_TARGET=https://example.com/landing-page
|
|
- REDIRECT_CODE=307
|
|
restart: unless-stopped
|