Skip to content

Instantly share code, notes, and snippets.

@varqasim
Created January 24, 2021 08:22
Show Gist options
  • Save varqasim/2e5a289f0a2283101b1a3fc4e9692615 to your computer and use it in GitHub Desktop.
Save varqasim/2e5a289f0a2283101b1a3fc4e9692615 to your computer and use it in GitHub Desktop.
HAProxy + AWS CloudMap + AWS ECS
FROM haproxy:2.3
COPY haproxy.cfg /usr/local/etc/haproxy/haproxy.cfg
global
maxconn 50000
log stdout local0
stats socket :9000 mode 660 level admin
defaults
mode http
log global
option httplog
option forwardfor
timeout connect 20s
timeout client 10m
timeout server 10m
resolvers awsvpc
nameserver dns1 172.31.0.2:53
resolve_retries 3
accepted_payload_size 8192
frontend www-http
# Redirect HTTP to HTTPS
bind *:80
# Adds http header to end of end of the HTTP request
http-request add-header X-Forwarded-Proto http
# Sets the default backend to use which is defined below with name 'www-backend'
default_backend core-backend
backend core-backend
balance roundrobin
# "hello" is the name of our service
# "app-inernal" is the name of our AWS CloudMap private zone
# "300" is the port of our ECS "hello" task
server-template web 5 hello.app-internal:3000 check resolvers awsvpc init-addr none
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment