nginx $request_uri map 白名单

阅读 108

2022-03-15


worker_processes  1;


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;
    keepalive_timeout  65;

    #gzip  on;
	map_hash_max_size 550;
	map_hash_bucket_size 500;
	map $request_uri $allow_uri {
		default 0;
		~/api/xxx\?.* 1;
		~/api/xxxs\?.* 1;
	}

    server {
        location / {
			if ( $allow_uri != 1 )
            {
                return 403;
            }
            proxy_pass   xxx:444;
        }
    }

}

精彩评论(0)

0 0 举报