title: How to use CloudFlare's HTTP Proxy with an AWS Application Load Balancer?
body: <p>I have configured an Amazon Web Services <a href="http://docs.aws.amazon.com/elasticloadbalancing/latest/application/introduction.html" rel="nofollow noreferrer">Application Load Balancer</a> with a few registered targets that are basic web applications. I have created a CNAME in CloudFlare and pointed this (using DNS ONLY option) to the A Record endpoint of my ALB. Things work how I would expect here and the setup feels pretty slick.</p>
  
  <p>I have created a listener on the ALB with rules so that requests to different subdomains or specific paths are routed to the correct target application like so:</p>
  
  <pre><code>IF host matches 'BLOG.mysite.com'     --&gt; target containing blog app
  IF host matches 'mysite.com/V1/CHAT'  --&gt; target containing chat API
  DEFAULT                               --&gt; default target
  </code></pre>
  
  <p><strong>Things go haywire when I turn CloudFlare's HTTP Proxy <em>ON</em> for this CNAME.</strong> Requests to the CNAME which would usually return a working webpage (html and shortly after assets like JS, css and images) time out. This is disappointing because CloudFlare's HTTP Proxy is available to me at no additional cost and offers a myriad of security features like DDos protection, etc.</p>
  
  <p>Does anyone know why this happens and how to get around it? Does the ALB not have access to the host of the request from the internet when HTTP proxy is turned on?</p>
  
  <p>UPDATE: What I believe is happening is that my ALB rules containing a match case on the HOST stop working when CloudFlare HTTP Proxy is turned on because the host name is changed or modified. However, I have yet to prove this.</p>