Skip to content

Commit 0f3d5f7

Browse files
Add domain to domain redirect example (#273)
* Add domain to domain redirect example * Added some debugging options * remove line highlighting * Apply suggestions from code review Co-authored-by: ShadowArcanist <162910371+ShadowArcanist@users.noreply.github.com> * Update redirects.md --------- Co-authored-by: ShadowArcanist <162910371+ShadowArcanist@users.noreply.github.com>
1 parent aa4701d commit 0f3d5f7

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

docs/knowledge-base/proxy/traefik/redirects.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,26 @@ traefik.http.middlewares.example-middleware.redirectregex.replacement=${1}://www
4747
traefik.http.middlewares.example-middleware.redirectregex.permanent=true
4848
```
4949

50+
### domain -> other domain
51+
52+
```bash
53+
traefik.http.middlewares.redirect-otherdomain.redirectregex.regex=^(https?://)?source-domain\.com(.*)
54+
traefik.http.middlewares.redirect-otherdomain.redirectregex.replacement=https://target-domain.com${2}
55+
traefik.http.middlewares.redirect-otherdomain.redirectregex.permanent=true
56+
```
57+
58+
If you also need to generate a ssl cert for the target-domain, additionally add a routers entry
59+
60+
```bash
61+
traefik.http.routers.redirect-otherdomain.middlewares=redirect-to-https
62+
traefik.http.routers.redirect-otherdomain.rule=Host(`target-domain.com`) && PathPrefix(`/`)
63+
traefik.http.routers.redirect-otherdomain.entryPoints=https
64+
traefik.http.routers.redirect-otherdomain.middlewares=redirect-otherdomain
65+
traefik.http.routers.redirect-otherdomain.rule=Host(`target-domain.com`) && PathPrefix(`/`)
66+
traefik.http.routers.redirect-otherdomain.tls.certresolver=letsencrypt
67+
traefik.http.routers.redirect-otherdomain.tls=true
68+
```
69+
5070
## Docker Compose based Applications & one-click Services
5171

5272
- You need to set both FQDNs for your resource, so for example: `coolify.io,www.coolify.io`
@@ -67,3 +87,25 @@ traefik.http.middlewares.example-middleware.redirectregex.regex=^(http|https)://
6787
traefik.http.middlewares.example-middleware.redirectregex.replacement=${1}://www.${2}
6888
traefik.http.middlewares.example-middleware.redirectregex.permanent=true
6989
```
90+
91+
## Debugging
92+
93+
You can check, if the traefik settings have been correctly applied, when inspecting your docker target container.
94+
95+
Find your docker container id
96+
```bash
97+
docker ps
98+
```
99+
100+
Inspect the containers labels
101+
102+
```bash
103+
docker inspect <container-id>
104+
```
105+
106+
You can additionally check the traefik container logs, by running
107+
108+
```bash
109+
docker logs -f coolify-proxy
110+
```
111+

0 commit comments

Comments
 (0)