Limit bandwidth per-IP by value from HTTP Header -
i have file download site. limiting bandwidth per ip (!). limit should set dynamically http header backend.
my current implementation uses x-accel-limit-rate (i can change header, it's not hard-coded anywhere), limit current connection/request.
is idea doable in g-wan?
yes, can done.
write g-wan handler extract x-accel-limit-rate
http header. enforce policy using throttle_reply()
g-wan api call documented here.
an example available called throttle.c might further.
the throttle_reply()
g-wan function lets apply throttling on global basis or per connection, apply relevant throttling values either ip addresses
or authenticated users
, depending on needs.
throttle_reply()
can change download speed dynamically during lifespan of each connection can slow-down old connections , create new ones adaptive download rate.
of course, can enforced on per client ip address (or cookie, or isp/datacenter record) deal huge workloads.
Comments
Post a Comment