{
    email {env.CLOUDFLARE_EMAIL}
    acme_dns cloudflare {env.CLOUDFLARE_API_TOKEN}
    acme_ca https://acme-v02.api.letsencrypt.org/directory
    debug
}
bizmatch.net {

}
www.bizmatch.net {

}
bayarea-cc.com {
    # TLS-Direktive entfernen, falls Cloudflare die Verbindung terminiert
    # tls {
    #    dns cloudflare {env.CLOUDFLARE_API_TOKEN}
    # }
    
    handle /api {
        reverse_proxy host.docker.internal:3001
    }
    handle {
        root * /app
        try_files {path} /index.html
        file_server
    }
    log {
        output stderr
        format console
    }
    encode gzip
}
www.bayarea-cc.com {
    redir https://bayarea-cc.com{uri} permanent
}
auth.bizmatch.net {
        reverse_proxy https://bizmatch-net.firebaseapp.com {
            header_up Host bizmatch-net.firebaseapp.com
            header_up X-Forwarded-For {remote_host}
            header_up X-Forwarded-Proto {scheme}
            header_up X-Real-IP {remote_host}
        }
}
gitea.bizmatch.net {
    reverse_proxy gitea:3500
}

dev.bizmatch.net {
  handle /pictures/* {
    root * /home/aknuth/git/bizmatch-project/bizmatch-server
    file_server
  }

  handle {
    root * /srv
    try_files {path} {path}/ /index.html
    file_server
  }
  
  log {
    output file /var/log/caddy/access.log {
      roll_size 10MB
      roll_keep 5
      roll_keep_for 48h
    }
  }

  encode gzip 

}

api-dev.bizmatch.net {
  reverse_proxy host.docker.internal:3000 {
    header_up X-Real-IP {http.request.header.CF-Connecting-IP}
    header_up X-Forwarded-For {http.request.header.CF-Connecting-IP}
    header_up X-Forwarded-Proto {http.request.header.X-Forwarded-Proto}
    header_up CF-IPCountry {http.request.header.CF-IPCountry}
  }
}

mailsync.bizmatch.net {
  reverse_proxy host.docker.internal:5000 {
    header_up X-Real-IP {http.request.header.CF-Connecting-IP}
    header_up X-Forwarded-For {http.request.header.CF-Connecting-IP}
    header_up X-Forwarded-Proto {http.request.header.X-Forwarded-Proto}
    header_up CF-IPCountry {http.request.header.CF-IPCountry}
  }
}

mail.andreasknuth.de {
    reverse_proxy nginx-mailcow:8080
}
web.email-bayarea.com {
    reverse_proxy nginx-mailcow:8080
}
mail.email-srvr.com autodiscover.mail.email-srvr.com autoconfig.mail.email-srvr.com {
    reverse_proxy nginx-mailcow:8080
}