#######################################################################################################
# COOKIE protect with captcha (local enabled)

secure_link $cookie__vis_prot,$cookie__vis_prot_expires;
secure_link_md5 "$secure_link_expires very-secure-secret-657899854654634 $remote_addr";

location = /cprot-captcha/request {

        allow all;
        auth_basic off;

        limit_req zone=rpsipdyn burst=10 delay=2;
        limit_req zone=rpsvhdyn burst=50 delay=9;
        error_page 429 /error/429.html;

        proxy_pass http://127.0.0.1:9199;

        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $host;

}

location ^~ /cprot-captcha/ {
        allow all;
        auth_basic off;
        alias /usr/share/cprot-captcha2/frontend/;
        try_files $uri =403;
}

location @cprot-captcha {
        allow all;
        auth_basic off;
        root /usr/share/cprot-captcha2/frontend;
        try_files /index.html =403;
}
