1. The problem I’m having:
I’m using caddy server for a callback listener installation that i have.
Callbacks are essentially payments updates.
I’m able to receive the callback but the system in stuck in an infinite redirect loop and doesn’t hit my server located at localhost:3000.
i can’t only have https request made to my callback listener url because the payment company only send http request on sandbox
2. Error messages and/or full log output:
{"level":"info","ts":1725613155.9954963,"logger":"http.log.access.log0","msg":"handled request","request":{"remote_ip":"52.236.59.28","remote_port":"39804","client_ip":"52.236.59.28","proto":"HTTP/1.1","method":"POST","host":"momo.boursenumeriquedafrique.com:80","uri":"/mtn","headers":{"Content-Length":["234"],"Connection":["Keep-Alive"],"User-Agent":["LWAC Http Client 1.0"],"Accept-Encoding":["gzip,deflate"],"Content-Type":["application/json; charset=utf-8"]}},"bytes_read":0,"user_id":"","duration":0.00083802,"size":0,"status":308,"resp_headers":{"Server":["Caddy"],"Connection":["close"],"Location":["https://momo.boursenumeriquedafrique.com/mtn"],"Content-Type":[]}}
{"level":"info","ts":1725613157.0462492,"logger":"http.log.access.log0","msg":"handled request","request":{"remote_ip":"52.236.59.28","remote_port":"39806","client_ip":"52.236.59.28","proto":"HTTP/1.1","method":"POST","host":"momo.boursenumeriquedafrique.com:80","uri":"/mtn","headers":{"Content-Type":["application/json; charset=utf-8"],"Content-Length":["234"],"Connection":["Keep-Alive"],"User-Agent":["LWAC Http Client 1.0"],"Accept-Encoding":["gzip,deflate"]}},"bytes_read":0,"user_id":"","duration":0.000604014,"size":0,"status":308,"resp_headers":{"Server":["Caddy"],"Connection":["close"],"Location":["https://momo.boursenumeriquedafrique.com/mtn"],"Content-Type":[]}}
{"level":"info","ts":1725613217.1610556,"logger":"http.log.access.log0","msg":"handled request","request":{"remote_ip":"52.236.59.28","remote_port":"40054","client_ip":"52.236.59.28","proto":"HTTP/1.1","method":"POST","host":"momo.boursenumeriquedafrique.com:80","uri":"/mtn","headers":{"Accept-Encoding":["gzip,deflate"],"Content-Type":["application/json; charset=utf-8"],"Content-Length":["234"],"Connection":["Keep-Alive"],"User-Agent":["LWAC Http Client 1.0"]}},"bytes_read":0,"user_id":"","duration":0.000620015,"size":0,"status":308,"resp_headers":{"Server":["Caddy"],"Connection":["close"],"Location":["https://momo.boursenumeriquedafrique.com/mtn"],"Content-Type":[]}}
{"level":"info","ts":1725613277.2180464,"logger":"http.log.access.log0","msg":"handled request","request":{"remote_ip":"52.236.59.28","remote_port":"40238","client_ip":"52.236.59.28","proto":"HTTP/1.1","method":"POST","host":"momo.boursenumeriquedafrique.com:80","uri":"/mtn","headers":{"Content-Type":["application/json; charset=utf-8"],"Content-Length":["234"],"Connection":["Keep-Alive"],"User-Agent":["LWAC Http Client 1.0"],"Accept-Encoding":["gzip,deflate"]}},"bytes_read":0,"user_id":"","duration":0.000422343,"size":0,"status":308,"resp_headers":{"Server":["Caddy"],"Connection":["close"],"Location":["https://momo.boursenumeriquedafrique.com/mtn"],"Content-Type":[]}}
3. Caddy version:
v2.8.4 h1:q3pe0wpBj1OcHFZ3n/1nl4V4bxBrYoSoab7rL9BMYNk=
4. How I installed and ran Caddy:
a. System environment:
Ubuntu 24.04 LTS , RISCV 64
b. Command:
sudo systemctl restart caddy
c. Service/unit/compose file:
d. My complete Caddy config:
momo.boursenumeriquedafrique.com {
tls {
issuer zerossl pdf {
dns_ttl 10m20s
}
}
# Redirect http to https
@http {
protocol http
}
redir @http https://{host}{uri} permanent
@allowed_methods {
method POST PUT
}
reverse_proxy @allowed_methods localhost:3000
@disallowed_methods {
not method POST PUT
}
respond @disallowed_methods 405
log {
output file /var/log/caddy/boursenumerique.log
format json
}
}