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

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -