Hi,
I finally found a way to add Sogo to a subdomain and I’m happy to share a snippet from my docker-compose file.
The caveat in the solution is that SOGo requests static resources from another path /SOGo.woa. As per below example 1) and 2), results in 403 Forbidden and got myself banned from the server (thx Fail2Ban 😄 ).
1) https://webmail.example.org/ -> http://mailcow.local/SOGo
2) https://webmail.example.org/SOGo.woa -> http://mailcow.local/SOGo/SOGo.woa
So I got the solution from this link to create 2 frontends (or routers in Traefik 2). So that seems to route the traffic correctly! 😀
1) https://webmail.example.org/ -> http://mailcow.local/SOGo
2) https://webmail.example.org/SOGo.woa -> http://mailcow.local/SOGo.woa
labels:
- "traefik.enable=true"
- "traefik.docker.network=traefik_web"
# Routers
- "traefik.http.routers.mailcow.rule=HostRegexp(`{host:(autodiscover|autoconfig|webmail|mail).+}`)"
- "traefik.http.routers.mailcow.entrypoints=web"
- "traefik.http.routers.mailcow.middlewares=mailcow_redirect@docker"
- "traefik.http.middlewares.mailcow_redirect.redirectscheme.scheme=https"
- "traefik.http.routers.mailcow_secure.rule=Host(`mail.example.org`)"
- "traefik.http.routers.mailcow_secure.entrypoints=websecure"
- "traefik.http.routers.mailcow_secure.tls=true"
- "traefik.http.routers.mailcow_secure.tls.certresolver=cloudflare"
- "traefik.http.routers.mailcow_secure.service=mailcow_secure@docker"
## Webmail Addprefix to Sogo
- "traefik.http.routers.webmail_secure.rule=Host(`webmail.example.org`)"
- "traefik.http.routers.webmail_secure.entrypoints=websecure"
- "traefik.http.routers.webmail_secure.tls=true"
- "traefik.http.routers.webmail_secure.tls.certresolver=cloudflare"
- "traefik.http.routers.webmail_secure.middlewares=webmail_addprefix_sogo"
- "traefik.http.routers.webmail_secure.service=mailcow_secure@docker"
## Webmail Sogo Static Resources
- "traefik.http.routers.webmail_static_secure.rule=Host(`webmail.example.org`) && PathPrefix(`/SOGo.woa`)"
- "traefik.http.routers.webmail_static_secure.entrypoints=websecure"
- "traefik.http.routers.webmail_static_secure.tls=true"
- "traefik.http.routers.webmail_static_secure.tls.certresolver=cloudflare"
- "traefik.http.routers.webmail_static_secure.service=mailcow_secure@docker"
# Services
- "traefik.http.services.mailcow_secure.loadbalancer.server.port=80"
# Middlewares
- "traefik.http.middlewares.webmail_addprefix_sogo.addprefix.prefix=/SOGo"
Have fun configuring your Mailcow delight!
Cheers
Glenn