title: Using HAProxy to Front Amazon S3
body: <p>I have Direct Connect over a fast pipe to an AWS VPC and I'd like to use a cluster of HAProxy instances in my VPC to reverse-proxy one or more S3 buckets. This is so my users on premises can enjoy the increased bandwidth.</p>
  <p>I guess the main question is whether this is doable, with the follow-on, &quot;Is there a better solution for this than HAProxy?&quot; I don't want to use an explicit proxy like squid because my only use-case for this is S3.</p>
  <p>Assuming HAProxy is fine, I did a quick dummy setup for one bucket as a POC. When I connect directly to the bucket without credentials (simply to test connectivity), I see the &quot;Access Denied&quot; XML response I expect. But when I connect to the reverse-proxy, it seems to redirect me to <a href="https://aws.amazon.com/s3/" rel="nofollow noreferrer">https://aws.amazon.com/s3/</a>. How am I screwing this up?</p>
  <p>Here's my config (replace MY_BUCKET with any bucket name):</p>
  <pre><code>global
          daemon
          maxconn 256
  
  defaults
          mode http
          timeout connect 5000ms
          timeout client 50000ms
          timeout server 50000ms
  
  frontend http-in
          bind *:80
          default_backend servers
  
  backend servers
          server server1 MY_BUCKET.s3.amazonaws.com:80 maxconn 100
  </code></pre>