Nginx or Lighttd redirect to cdn when load is high

Im trying to set up a server for static asset delivery with NGINX, but I need to somehow check the load on the server to redirect all requests to a CDN if server is load is +x amount

for example

if(server_load > 50/100)
redirect all requests to
else {

Does nginx have anything like this? I could work with lighttpd too
Mario BernheimCTOAsked:
Who is Participating?
Aaron TomoskySD-WAN SimplifiedCommented:
You can set it up as a load balancer, perhaps with weights that you can adjust as the load changes?

If it’s just static http images this should be fine, for anything https make sure you sticky sessions (iphash I believe for nginx)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.