Last active
June 18, 2022 21:32
-
-
Save haproxytechblog/4aa75c1ca498138ca50841f723fa521f to your computer and use it in GitHub Desktop.
Using HAProxy as an API Gateway, Part 1
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
| frontend api_gateway | |
| bind :443 ssl crt /etc/hapee-1.8/certs/cert.pem | |
| acl PATH_cart path_beg -i /cart | |
| acl PATH_catalog path_beg -i /catalog | |
| use_backend be_cart if PATH_cart | |
| use_backend be_catalog if PATH_catalog | |
| backend be_cart | |
| server s1 10.0.0.3:80 | |
| backend be_catalog | |
| server s1 10.0.0.5:80 |
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
| frontend api_gateway | |
| bind :443 ssl crt /etc/hapee-1.8/certs/cert.pem | |
| acl VHOST_publicapi req.hdr(Host) -i -m dom api.haproxy.com api.haproxy.fr | |
| acl VHOST_partnersapi req.hdr(Host) -i -m dom partner.haproxy.com partner.haproxy.fr | |
| acl PATH_catalog path_beg -i /catalog | |
| acl PATH_cart path_beg -i /cart | |
| acl PATH_inventory path_beg -i /inventory | |
| use_backend be_cart if VHOST_publicapi PATH_cart | |
| use_backend be_catalog if VHOST_publicapi PATH_catalog | |
| use_backend be_inventory if VHOST_partnersapi PATH_inventory | |
| backend be_cart | |
| server s1 10.0.0.3:80 | |
| backend be_catalog | |
| server s1 10.0.0.5:80 | |
| backend be_inventory | |
| server s1 10.0.0.7 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment