Last active
August 15, 2024 15:15
-
-
Save fumin/7456722 to your computer and use it in GitHub Desktop.
Haproxy config file for SSL and basic authentication
This file contains 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
# Haproxy config file for SSL and basic authentication | |
# | |
# Since ssl is needed, we need to use | |
# `make TARGET=linux26 USE_OPENSSL=1 ADDLIB=-lz` to install haproxy. | |
# Also, haproxy version must be haproxy-1.5-dev19 or above. | |
# | |
# An example curl command that queryies pic-collage.com/api/collages/feed is | |
# `curl -k -v -u 'collages:password' 'https://ec2-ip.compute-1.amazonaws.com/api/collages/feed'` | |
userlist collages_dyno | |
user collages password $6$bde0d6473cfe3e85$kiKo9a/.ijIejPHq0sWdrl106hDQG91ukqJGLJqKpsT3ja0AHRHpFe2wuZMtvBf6lGKMs8EZjQ9U12sDiYsS30 | |
global | |
log 127.0.0.1 local0 debug | |
defaults | |
timeout connect 5000 | |
timeout client 55000 | |
timeout server 55000 | |
option forceclose | |
frontend heroku_dynos | |
log global | |
option httplog | |
bind :443 ssl crt /etc/haproxy/cert.pem | |
mode http | |
acl search_collages http_auth(collages_dyno) | |
http-request allow if search_collages | |
http-request deny | |
use_backend collages_domain if search_collages | |
backend collages_domain | |
mode http | |
reqirep ^Host: Host:\ doc-collages-db3kv4m5ns2pyeemdlqsvedai4.us-east-1.cloudsearch.amazonaws.com | |
server haproxy_collages_backend doc-collages-db3kv4m5ns2pyeemdlqsvedai4.us-east-1.cloudsearch.amazonaws.com:80 | |
backend test_domain | |
mode http | |
reqirep ^Host: Host:\ pic-collage.com | |
server haproxy_test_backend pic-collage.com:80 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment