我正在为Web应用程序开发一个模块.要触发此模块,我需要向服务器提交一些数据.对于简单的表单,从开发人员工具"复制为cURL"工作正常(使用来自msys [git]的curl),但是对于具有multipart/form-data的post请求,复制的字符串既不能用于windows shell(cmd)也不能用于bash (表格msys); 复制的文本类似于
curl "http://myserver.local" -H "Origin: http://wiki.selfhtml.org" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.130 Safari/537.36" -H "Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryntXdlWbYXAVwCIMU" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8" -H "Cache-Control: max-age=0" -H "Referer: http://wiki.selfhtml.org/extensions/Selfhtml/frickl.php/Beispiel:HTML_form-Element1.html" -H "Connection: keep-alive" --data-binary "------WebKitFormBoundaryntXdlWbYXAVwCIMU"^ "Content-Disposition: form-data; name=""area"""^ "multi"^ "line"^ "------WebKitFormBoundaryntXdlWbYXAVwCIMU--"^ "" --compressed
有什么办法,我可以使用它或将其转换为可用的东西吗?
我不知道如何配置检查是否$remote_user等于location.
location / {
auth_basic "ElasticSearch";
auth_basic_user_file /etc/nginx/search_passwords;
location ~/([^/]*)/ { # named capture did not work either
if ($remote_user = $1) { # ERROR: Unknown variable: $1 / $NAMEDWHATEVER
break;
}
}
}
Run Code Online (Sandbox Code Playgroud)
我的用例:
我正在尝试通过使用 nginx 反向代理进行身份验证来“保护” ElasticSearch-Cluster。我想允许多个用户,但新用户的修改应该尽可能简单;最好的情况 - 只需更改 htpasswd 文件。
我正在尝试采用nginx-elasticsearch-proxy,但无法检查remote_name和index-name是否相等。