title: Haproxy ability for multiple port 80, 443 frontends
body: <p>I have the need to have both layer7 and layer4. An api where i divert requests two 2 different backends. one backend for GET requests and one backend for PUT,GET &amp; DELETE requests. That being my layer 7 front end.  </p>
  
  <p>The layer4 front to handle websites who make the api requests. They just split round robin. </p>
  
  <p>Layer7 was working consistently before I add in this layer4 section, ie just did our loadbalancing for the api. As i migrate the websites w/ the layer4 frontend, api requests, ie layer7, get lost sometimes but not always. </p>
  
  <p><strong>As you can see, sometimes request is lost, sometimes works:</strong></p>
  
  <pre><code>[richv@lb2 ~]$ curl api
  curl: (52) Empty reply from server                   &lt;-- this is not ok, http 503
  [richv@lb2 ~]$ curl api
  {"error_code":256,"error_message":"No Site specified"}  &lt;-- this is ok, cause didnt give all the headers.
  </code></pre>
  
  <p><strong>Front ends are:</strong></p>
  
  <pre><code>frontend layer7-http-listener
  bind *:80
  bind *:443 ssl crt /etc/httpd/certs/haproxy.pem
  mode http
  option      httpclose
  option      httplog
  option      forwardfor
  option accept-invalid-http-request
  
  frontend layer4-listener
  bind *:80  transparent
  bind *:443 transparent
  bind *:3306
  mode tcp
  option      tcplog
  </code></pre>