kamal icon indicating copy to clipboard operation
kamal copied to clipboard

(SOLVED) Kamal 2.0 Behind Cloudflare and AWS ALB Loadbalancer

Open kobaltz opened this issue 1 year ago • 0 comments

My current infrastructure looks like this

Cloudflare (443) -> AWS Load Balancer (443) --> Web Server 1 (Kamal Proxy 80)
                                            --> Web Server 2 (Kamal Proxy 80)

I upgraded to Kamal 2.0.0 and "successfully deployed" with the new kamal-proxy. However, the Rails logs showed that most of the requests failed with Unsupported HTTP Method used: PRI It looks like it could have something to do with HTTP/2.

CleanShot 2024-09-26 at 21 44 18

I looked in the AWS Load Balancer and saw that my Target Group was set to HTTP2.

CleanShot 2024-09-26 at 21 56 59

I created a new Target Group with the exact same config EXCEPT the Protocol Version was set to HTTP1. There really shouldn't be a reason to specifically use HTTP2 in my case since Cloudflare was handling the initial handshake.

There isn't any action required for this issue. I wanted to share this in case someone else runs across this issue as it wasn't abundantly clear where the problem was. I wrote up my experience and resolution as well here. https://blog.driftingruby.com/kamal-2-0-issue-with-aws-alb/

kobaltz avatar Sep 27 '24 02:09 kobaltz