Как задать чтение параметров при гет и пост запросе в nginx?

Пытаюсь задать чтение параметров GET и чтение тела POST, чтобы получить один из параметров для проверки, вот код:

user nginx;
worker_processes auto;
pid /run/nginx.pid;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    sendfile        on;
    keepalive_timeout  65;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for" "$request_body" "$args" $arg_venueId';

    access_log  /var/log/nginx/access.log  main;
    error_log /var/log/nginx/error.log;

    server {
        root   /usr/share/nginx/html;
        listen       8081;
        server_name  localhost;


        location ~ /sessions
        {
            if ($request_method = POST) {
                return 405;
            }
            
            if ($request_method = GET) {
             if ($args ~ "venueId=Example") { 
                    return 401
             }
             return 405; 

            }
        }
    }
}

В логах при пост запросе $request_body - стоит "-", а не сами параметры А с этой строчкой "if ($args ~ "venueId=Example")" - пишет ошибку: "unknown directive "if($args""

Nginx 1.13


Ответы (0 шт):