Hello,
Have been working with Traefik for the past few weeks and I seem to get the hang of it as most of the things are working now after some vigorous testing and learning.
Now I seem to have hit a roadblock I am not able to solve even though I think it is correct, it must be wrong because it does not work
I am running a server with Docker and have several Docker containers running successfully but these are all PHP applications. Now I am trying to setup a Docker container with Mailcatcher and it only works half. The webinterface on port 1080 I can see and it is shown but the SMTP part is not responding as it should. Here is the output:
telnet mailcatcher.domain.com 1025
Trying 173.212.200.143...
Connected to mailcatcher.domain.com.
Escape character is '^]'.
When I press Enter here I see this response:
HTTP/1.1 400 Bad Request
Content-Type: text/plain; charset=utf-8
Connection: close
400 Bad RequestConnection closed by foreign host.
This makes me believe it is processing it as an http request instead of an smtp request.
There is an error in the Traefik dashboard. The error shown is:
RULE
Host(`mailcatcher.domain.com`)
NAME
mailcatcher-smtp@docker
ENTRYPOINTS
mailcatchersmtp
ERRORS
invalid rule: "Host(`mailcatcher.domain.com`)" , unsupported function: Host
Could someone please have a look and tell me what I am doing wrong?
Thank you very much.
Here is my setup
Trafeik.toml
[log]
level = "DEBUG"
filePath = '/var/log/traefik.log'
[accessLog]
filePath = '/var/log/access.log'
bufferingSize = 100
[providers]
[providers.docker]
watch = true
exposedByDefault = false
network = "traefik-proxy"
[entryPoints]
[entryPoints.web]
address = ":80"
[entryPoints.web.http]
[entryPoints.web.http.redirections]
[entryPoints.web.http.redirections.entryPoint]
to = "websecure"
scheme = "https"
[entryPoints.websecure]
address = ":443"
[entryPoints.websecure.http.tls]
certResolver = "lets-encrypt"
[entryPoints.mailcatcherweb]
address = ":1080"
[entryPoints.mailcatcherweb.http.tls]
certResolver = "lets-encrypt"
[entryPoints.mailcatchersmtp]
address = ":1025"
[certificateResolvers]
[certificatesResolvers.lets-encrypt]
[certificatesResolvers.lets-encrypt.acme]
storage = "/etc/traefik/acme.json"
email = "some@mailaddress"
tlsChallenge = true
[api]
insecure = false
dashboard = true
Mailcatcher docker-compose.yml
version: "3.8"
services:
mailcatcher:
image: dockage/mailcatcher:latest
container_name: "mailcatcher"
restart: unless-stopped
labels:
- "traefik.enable=true"
- "traefik.docker.network=traefik-proxy"
- "traefik.http.routers.mailcatcher-web.rule=Host('mailcatcher.domain.com')"
- "traefik.http.routers.mailcatcher-web.entrypoints=mailcatcherweb"
- "traefik.http.routers.mailcatcher-web.service=mailcatcher-web"
- "traefik.http.services.mailcatcher-web.loadbalancer.server.port=1080"
- "traefik.tcp.routers.mailcatcher-smtp.rule=HostSNI('mailcatcher.domain.com')"
- "traefik.tcp.routers.mailcatcher-smtp.entrypoints=mailcatchersmtp"
- "traefik.tcp.routers.mailcatcher-smtp.service=mailcatcher-smtp"
- "traefik.tcp.services.mailcatcher-smtp.loadbalancer.server.port=1025"
networks:
- traefik-proxy
networks:
traefik-proxy:
external: true
UFW config
Status: active
To Action From
-- ------ ----
OpenSSH ALLOW Anywhere
80/tcp ALLOW Anywhere
443 ALLOW Anywhere
1080/tcp ALLOW Anywhere
1025/tcp ALLOW Anywhere
8025/tcp ALLOW Anywhere
25/tcp ALLOW Anywhere
OpenSSH (v6) ALLOW Anywhere (v6)
80/tcp (v6) ALLOW Anywhere (v6)
443 (v6) ALLOW Anywhere (v6)
1080/tcp (v6) ALLOW Anywhere (v6)
1025/tcp (v6) ALLOW Anywhere (v6)
8025/tcp (v6) ALLOW Anywhere (v6)
25/tcp (v6) ALLOW Anywhere (v6)