HAProxy + Docker Compose: HTTP to HTTPS redirect & slow file downloads on backend

Hi everyone,

I’m setting up HAProxy inside Docker Compose as a reverse proxy for the site (which serves static pages alongside direct software/build downloads), and I’ve run into two small config issues:

  1. HTTPS Redirect Loop / Path Routing: When users hit https://mojolauncher.net, the redirect to HTTPS works, but requests to our /downloads/ path occasionally hit the default web backend instead of our dedicated file storage backend.

  2. Download Speeds Under Load: Larger file downloads start fast but throttle or drop after ~20–30 seconds when multiple users download at the same time.

Here is the relevant part of my haproxy.cfg:

Code snippet

frontend http_front
    bind *:80
    bind *:443 ssl crt /usr/local/etc/haproxy/certs/site.pem
    http-request redirect scheme https code 301 unless { ssl_fc }

    acl is_downloads path_beg /downloads/
    use_backend files_backend if is_downloads
    default_backend web_backend

backend web_backend
    server web1 172.18.0.3:8080 check

backend files_backend
    timeout server 120s
    server files1 172.18.0.4:9000 check

Should I split port 80 and port 443 into separate frontends to fix the ACL routing, and are there specific buffer/tuning options (tune.bufsize or option http-no-delay) recommended for serving large file downloads cleanly through HAProxy?

Thanks in advance!