Fix HAProxy configuration issues and add blocked backend
All checks were successful
HAProxy Manager Build and Push / Build-and-Push (push) Successful in 50s
All checks were successful
HAProxy Manager Build and Push / Build-and-Push (push) Successful in 50s
**Problems Fixed:** - Remove invalid 'http-request set-status' directive (not supported in HAProxy 3.0.11) - Replace with proper blocked backend using 'http-request return' - Add blocked backend template for serving blocked page with 403 status **Changes Made:** - Create hap_blocked_backend.tpl template for blocked IPs - Update hap_listener.tpl to use blocked-backend instead of invalid status setting - Modify haproxy_manager.py to include blocked backend in config generation - Add blocked_ip_page.html copying to HAProxy directory during config generation **Technical Details:** - HAProxy 3.0.11 doesn't support 'http-request set-status' directive - Use 'http-request return status 403 content-type text/html file' instead - Blocked IPs now get proper 403 status with custom HTML page - Configuration validation should now pass without errors **Testing:** - HAProxy configuration validation should succeed - Blocked IPs should see custom page with 403 status - All existing functionality maintained 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
11
templates/hap_blocked_backend.tpl
Normal file
11
templates/hap_blocked_backend.tpl
Normal file
@@ -0,0 +1,11 @@
|
||||
# Backend for blocked IPs - serves blocked page with 403 status
|
||||
backend blocked-backend
|
||||
mode http
|
||||
option http-server-close
|
||||
http-request set-header X-Forwarded-Proto https if { ssl_fc }
|
||||
http-request set-header X-Forwarded-Port %[dst_port]
|
||||
http-request set-header X-Forwarded-For %[src]
|
||||
http-request set-header X-Real-IP %[src]
|
||||
|
||||
# Return 403 Forbidden for blocked IPs
|
||||
http-request return status 403 content-type text/html file /etc/haproxy/blocked_ip_page.html
|
Reference in New Issue
Block a user