Caddy on EC2 and behind ELB

How to run Caddy behing ELB?
My ELB have 2 listeners: 80 → 80 and 443 → 443 (with SSL certs from Amazon) and I want to use self-signed certs on Caddy.

The First thing I did is run setcap cap_net_bind_service=+ep caddy
Then I configure my Caddyfile:

studies-api.my-domain.com:443 {
    redir https://studies-api.my-domain.com{uri}
    tls self_signed
    proxy /api localhost:3000 {
      without /api
      transparent
    }

    root ./
    gzip
    log ./access.log
}

studies-api.my-domain.com:80/admin {
    redir https://studies-api.my-domain.com{uri}
    tls self_signed
    root admin
    gzip
    log ./access.log
}

studies-my-domain.com:80/gem {
    redir https://studies-api.my-domain.com{uri}
    tls self_signed
    root studies/gem
    gzip
    log ./access.log
}

Hitting the http version of my site works (at least the static pages). but the server that is running on port 300 is not getting the request. update: it’s not always working. i am not sure why.

I am new to Caddy, so any advice would be appreciated.
Thanks!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.