Rate limit based on server ip in backend

Basically, I want to put rate limit based on server ip when the requested url return status 429.
My approach is:

  • Use sticky-table to persist flag that server ip has encountered 429

  • Call dynamic runtime API to set flag for server ip

    frontend rotatingproxies
    bind *:3128
    option httplog
    stick-table type ip size 1m expire 5m store gpc0
    http-request deny deny_status 429 if { sc0_get_gpc0 ge 1 }
    default_backend pool
    option http_proxy
    option forwardfor
    option http-use-proxy-header
    option accept-invalid-http-request

    backend pool
    mode http
    server proxy1 ip1:port1
    balance roundrobin

My problem is I don’t know how to config that makes sticky-table get gpc0 value of server ip.
The line http-request deny deny_status 429 if { sc0_get_gpc0 ge 1 } make no sense.
My questions are:

  • In frontend section, how can I know which server ip in backed was used ?
  • Could I do something more elegant, like check based status code ?