0

I tried to run HAProxy inside a docker container which run with the AWS ECS. As per a requirement I received the container is run behind a classic load-balancer.

I managed the mentioned setup to work the with HTTP. But after I converted it to use SSL (Adding a certificate to ELB and configuring the HAProxy with SSL). I am getting a timeout error. I followed this tutorial, https://gist.github.com/sethwebster/b48d7c872fe397c1db11

My config for frontend is as follows,

frontend haproxy_in
    bind *:443 ssl crt /etc/ssl/private/domain.pem
    reqadd X-Forwarded-Proto:\ https
    acl url_api path_beg /api
    use_backend api-backend if url_api

    acl url_login path_beg /login
    use_backend login-backend if url_login

Here is my Dockerfile if needed.

FROM haproxy:1.7
ENV HAPROXY_USER haproxy

RUN groupadd --system ${HAPROXY_USER} && \
  useradd --system --gid ${HAPROXY_USER} ${HAPROXY_USER} && \
  mkdir --parents /var/lib/${HAPROXY_USER} && \
  chown -R ${HAPROXY_USER}:${HAPROXY_USER} /var/lib/${HAPROXY_USER}

COPY domain.pem /etc/ssl/private/domain.pem
COPY haproxy.cfg /usr/local/etc/haproxy/haproxy.cfg
CMD ["haproxy", "-db", "-f", "/usr/local/etc/haproxy/haproxy.cfg"]

Would anyone be able to help with the configuration ? I am trying to figure out if the timeout i receive is due to ELB or the HAProxy configuration. Thank you in advance.

  • Simple question but worth checking, but have you configured your ELB for SSL / HTTPS? – Tim Mar 27 '17 at 18:02
  • yes i have configured the ELB for SSL and tested it with another port. It worked fine. Only the HAproxy redirection doesn't seem to work. Or it's some other issue I am unable to find. I would very much appreciate if you have any input on the matter. – Lahiru Liyanapathirana Mar 28 '17 at 05:19

0 Answers0