I successfully got rate-based-limit working in Cloud Armor. reCaptcha works for me too. But I'm looking for a solution if cloud armor rate based can redirect users to recaptcha after exceeding some number of requests?
rate-based-limit
gcloud beta compute security-policies rules create 100 \
--security-policy=$CA_POLICY \
--expression="true" \
--action=rate-based-ban \
--rate-limit-threshold-count=50 \
--rate-limit-threshold-interval-sec=120 \
--ban-duration-sec=300 \
--conform-action=allow \
--exceed-action=deny-404 \
--enforce-on-key=IP
recaptcha redirect
gcloud compute security-policies rules create 101 \
--security-policy $CA_POLICY \
--expression "request.path.matches(\"/index.php\")" \
--action redirect \
--redirect-type google-recaptcha