Caddy could be even better instead of apache :)
As for getting the real IP of the visitor, it would be up to the SmarterMail built-in http server to look up for headers transmitted by the reverse proxy (if correctly configured for this), such as:
X-Forwarded-For
A comma‑separated list of IP addresses; the leftmost is usually the original client, and each proxy appends its own IP.
Example: X-Forwarded-For: 203.0.113.10, 198.51.100.1
X-Real-IP
Often set to the single “real” client IP (the one the proxy directly sees), without chaining.
Common in nginx‑style setups.
X-Forwarded-Proto
Not an IP header, but usually sent alongside: indicates the original scheme (http or https).
I don't know if SM cares about these. If not, it could really be a nice (mandatory?) addition.
Also it would require a configurable option in SM to declare IP addresses of "trusted proxies", so it only cares about these headers when the proxy IP is trusted.
Then SM should use this value as the visitor IP for incoming http requests.
Sébastien Riccio
System & Network Admin
https://swisscenter.com