【发布时间】:2019-02-22 06:47:40
【问题描述】:
我使用 nginx 作为 http 服务的反向代理,使用如下配置:
location /jobexecutor/ {
proxy_pass http://jobexecutor:8080/jobexecutor/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_redirect off;
proxy_connect_timeout 75s;
}
GET 请求被代理到服务很好,但是当我使用 POST 请求被代理到服务 OK,但正文是空的。直接发布到服务时,它工作正常。 有什么想法吗?
【问题讨论】:
-
@tdugeon 您使用什么技术来发送和接收 HTTP 请求?
-
@HatzavWolff 我正在使用 curl 进行测试。确切的命令是: curl -kL -X POST -H "Authorization: bearer $token" -F "ExecutionParameters=@ExecutionParametersSdf.json;type=application/json;filename=ExecutionParameters.json" -F "input=@../ ../../../data/testfiles/Kinase_inhibs.sdf;type=chemical/x-mdl-sdfile;filename=input" -H "Content-Type: multipart/mixed" nginx/jobexecutor/rest/v1/jobs/submit-async
-
@tdugeon 你如何检查 POST 正文?
-
在接收端的代码中。将正文作为字符串抓取并记录。直接访问时正常,通过反向代理访问时body为空。
-
@tdugeon 您能否将代码添加到“记录字符串”?另外,“直接访问”是什么意思——通过浏览器?