This snippet shows you how to use haproxy to restrict certain URLs to certain IP addresses. For example, to make sure your admin interface can only be accessed from your company IP address.
This snippet was tested on haproxy 1.5.
This snippet is tested on a Digital Ocean VPS. If you like this snippet and want to support me, plus get free credit @ DO, use this link to order a Digital Ocean VPS: https://www.digitalocean.com/?refcode=7435ae6b8212
This example restricts access to the
/helpdesk URL’s. It only allows access from the IP addresses
184.108.40.206. Any other IP addresses will get the standard haproxy 403 forbidden error. 继续阅读