Last active
October 13, 2021 17:37
-
-
Save kehers/8f346d077f4f7d0585a1 to your computer and use it in GitHub Desktop.
Simple HAProxy config to forward :80 to :3000 (for a Node app)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global | |
log /dev/log local0 | |
log /dev/log local1 notice | |
chroot /var/lib/haproxy | |
stats socket /run/haproxy/admin.sock mode 660 level admin | |
stats timeout 30s | |
user haproxy | |
group haproxy | |
daemon | |
# Default SSL material locations | |
ca-base /etc/ssl/certs | |
crt-base /var/www/ssl/ | |
# https://hynek.me/articles/hardening-your-web-servers-ssl-ciphers/ | |
ssl-default-bind-ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS | |
ssl-default-bind-options no-sslv3 | |
tune.ssl.default-dh-param 2048 | |
defaults | |
log global | |
mode http | |
option httplog | |
option dontlognull | |
timeout connect 5000 | |
timeout client 50000 | |
timeout server 50000 | |
errorfile 400 /etc/haproxy/errors/400.http | |
errorfile 403 /etc/haproxy/errors/403.http | |
errorfile 408 /etc/haproxy/errors/408.http | |
errorfile 500 /etc/haproxy/errors/500.http | |
errorfile 502 /etc/haproxy/errors/502.http | |
errorfile 503 /etc/haproxy/errors/503.http | |
errorfile 504 /etc/haproxy/errors/504.http | |
frontend http-in | |
bind :80 | |
reqadd X-Forwarded-Proto:\ http | |
default_backend app | |
# is this a socket io request? | |
acl is_websocket path_beg /socket.io | |
acl is_websocket hdr(Upgrade) -i WebSocket AND hdr_beg(Host) -i ws | |
use_backend websocket if is_websocket | |
frontend https-in | |
bind :443 ssl crt /etc/ssl/private/crt.pem | |
reqadd X-Forwarded-Proto:\ https | |
default_backend app | |
backend app | |
server node 127.0.0.1:3000 check | |
backend websocket | |
balance source | |
option forwardfor | |
no option httpclose | |
option http-server-close | |
option forceclose | |
timeout queue 5s | |
timeout server 24h | |
timeout connect 24h | |
server node1 localhost:3000 check |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment