Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
edited tags
Link
Rudy Lee
  • 165
  • 3
  • 8
Source Link
Rudy Lee
  • 165
  • 3
  • 8

HAProxy as reverse proxy for AWS API Gateway

As the title suggest, I have an AWS API Gateway endpoint that I want to put behind HAProxy.

This is my current HAProxy configuration

defaults mode http log global option httplog option dontlognull option http-server-close option forwardfor except 127.0.0.0/8 option redispatch retries 3 timeout http-request 10s timeout queue 1m timeout connect 10s timeout client 1m timeout server 1m timeout http-keep-alive 10s timeout check 10s maxconn 3000 listen http bind 127.0.0.1:8080 maxconn 18000 acl api_gateway path_beg /api-gateway use_backend api-gateway-backend if api-gateway backend api-gateway-backend http-request set-header Host xxxxx.execute-api.ap-southeast-2.amazonaws.com server api-gateway xxxxx.execute-api.ap-southeast-2.amazonaws.com:443 

When I hit the /api-gateway endpoint on my HAProxy, I get 400 Bad Request. See below:

api gateway 400

I tried to change the backend to use this server api-gateway xxxxx.execute-api.ap-southeast-2.amazonaws.com:443 ssl verify none but I got 503 Service Unavailable instead.

I think this could be related to SSL SNI configuration that I need to enable on HAProxy, see this forum post https://forums.aws.amazon.com/thread.jspa?threadID=240197