Search code examples
apacheunixload-balancing

Apache load balancer: enable/disable workers does not work anymore


I have a script that sends POST requests to Apache load balancer to change status_D parameter of the specified worker. This is supposed to enable or disable worker (0 - enable, 1 - disable). This used to work, but not anymore. Script is in Perl, but I tried sending the same request using curl, same result - status does not change. If I open load balancer web page in browser and change it from there - it works. I even captured browser's POST request parameters from the Apache log, copied and pasted them into curl command, but it still did not work, which makes me think that parameters are fine, but perhaps something has changed in Apache or proxy_balancer_module recently? Apache version is 2.4.52.0.1.


Solution

  • In new versions you need to add the referer in the http request.

    curl -s -o /dev/null -XPOST "http://${server}:${port}/${manager}?" \
    -H "Referer: http://${server}:${port}/${manager}?b=${balancer}&w=${worker}&nonce=${nonce}" -d b="${balancer}" \
    -d w="${worker}" -d nonce="${nonce}" -d w_status_D=1