我想做的功能:1.使用nginx+lua做基础签名认证,类似按照所有post或者get的k-v排序后加上一段秘钥做hash验证2.通过后将所有client的请求原样转到另外一个服务目前用了upload,问题出在读取后,再做转发后,到了另外一个服务上,数据就全没了· 请问怎么解决这个问题呢~lua只是做验证,通过后希望所有client的请求都不会丢失~ --
我想做的功能:1.使用nginx+lua做基础签名认证,类似按照所有post或者get的k-v排序后加上一段秘钥做hash验证2.通过后将所有client的请求原样转到另外一个服务目前用了upload,问题出在读取后,再做转发后,到了另外一个服务上,数据就全没了· 请问怎么解决这个问题呢~lua只是做验证,通过后希望所有client的请求都不会丢失~
你是怎么做转发的?能提供一个代码片段说明下吗?在 2016年1月15日 上午11:25,姜德斌 <bing...@gmail.com>写道:我想做的功能:1.使用nginx+lua做基础签名认证,类似按照所有post或者get的k-v排序后加上一段秘钥做hash验证2.通过后将所有client的请求原样转到另外一个服务目前用了upload,问题出在读取后,再做转发后,到了另外一个服务上,数据就全没了· 请问怎么解决这个问题呢~lua只是做验证,通过后希望所有client的请求都不会丢失~ --
status >= 200
ngx.HTTP_OK
.lua 中,就是使用了upload,然后read后解析成功后 ngx.exit(ngx.OK)nginx_conf中就是 location ~ { include "uwsgi ..."; access_by_lua_file xx.lua; proxy_pass http://xxx;}在 2016年1月15日星期五 UTC+8上午11:58:01,mbb写道:你是怎么做转发的?能提供一个代码片段说明下吗?在 2016年1月15日 上午11:25,姜德斌 <bing...@gmail.com>写道:我想做的功能:1.使用nginx+lua做基础签名认证,类似按照所有post或者get的k-v排序后加上一段秘钥做hash验证2.通过后将所有client的请求原样转到另外一个服务目前用了upload,问题出在读取后,再做转发后,到了另外一个服务上,数据就全没了· 请问怎么解决这个问题呢~lua只是做验证,通过后希望所有client的请求都不会丢失~ --
ngx.exit()When status >= 200 (i.e., ngx.HTTP_OK and above), it will interrupt the execution of the current request and return status code to nginx.感觉是这里的问题在 2016年1月15日星期五 UTC+8下午1:31:00,Binger写道:.lua 中,就是使用了upload,然后read后解析成功后 ngx.exit(ngx.OK)nginx_conf中就是 location ~ { include "uwsgi ..."; access_by_lua_file xx.lua; proxy_pass http://xxx;}在 2016年1月15日星期五 UTC+8上午11:58:01,mbb写道:你是怎么做转发的?能提供一个代码片段说明下吗?在 2016年1月15日 上午11:25,姜德斌 <bing...@gmail.com>写道:我想做的功能:1.使用nginx+lua做基础签名认证,类似按照所有post或者get的k-v排序后加上一段秘钥做hash验证2.通过后将所有client的请求原样转到另外一个服务目前用了upload,问题出在读取后,再做转发后,到了另外一个服务上,数据就全没了· 请问怎么解决这个问题呢~lua只是做验证,通过后希望所有client的请求都不会丢失~ -- --
Hello,如果这个不是你发的话,我想你可以看看https://github.com/openresty/lua-resty-upload/issues/21在 2016年1月15日 下午2:27,xiaooloong <xiaooo...@gmail.com>写道:ngx.exit()When status >= 200 (i.e., ngx.HTTP_OK and above), it will interrupt the execution of the current request and return status code to nginx.感觉是这里的问题在 2016年1月15日星期五 UTC+8下午1:31:00,Binger写道:.lua 中,就是使用了upload,然后read后解析成功后 ngx.exit(ngx.OK)nginx_conf中就是 location ~ { include "uwsgi ..."; access_by_lua_file xx.lua; proxy_pass http://xxx;}在 2016年1月15日星期五 UTC+8上午11:58:01,mbb写道:你是怎么做转发的?能提供一个代码片段说明下吗?在 2016年1月15日 上午11:25,姜德斌 <bing...@gmail.com>写道:我想做的功能:1.使用nginx+lua做基础签名认证,类似按照所有post或者get的k-v排序后加上一段秘钥做hash验证2.通过后将所有client的请求原样转到另外一个服务目前用了upload,问题出在读取后,再做转发后,到了另外一个服务上,数据就全没了· 请问怎么解决这个问题呢~lua只是做验证,通过后希望所有client的请求都不会丢失~ -- --
ngx.exit()When status >= 200 (i.e., ngx.HTTP_OK and above), it will interrupt the execution of the current request and return status code to nginx.感觉是这里的问题在 2016年1月15日星期五 UTC+8下午1:31:00,Binger写道:.lua 中,就是使用了upload,然后read后解析成功后 ngx.exit(ngx.OK)nginx_conf中就是 location ~ { include "uwsgi ..."; access_by_lua_file xx.lua; proxy_pass http://xxx;}在 2016年1月15日星期五 UTC+8上午11:58:01,mbb写道:你是怎么做转发的?能提供一个代码片段说明下吗?在 2016年1月15日 上午11:25,姜德斌 <bing...@gmail.com>写道:我想做的功能:1.使用nginx+lua做基础签名认证,类似按照所有post或者get的k-v排序后加上一段秘钥做hash验证2.通过后将所有client的请求原样转到另外一个服务目前用了upload,问题出在读取后,再做转发后,到了另外一个服务上,数据就全没了· 请问怎么解决这个问题呢~lua只是做验证,通过后希望所有client的请求都不会丢失~ --
哈哈,这个是我发的~ 最后也没有得到解决,目前我们的方式是,有文件的时候,我们把参数放到querystring中,post的body中不再放置key-value的数据~在 2016年1月15日星期五 UTC+8下午3:15:19,doujiang写道:Hello,如果这个不是你发的话,我想你可以看看https://github.com/openresty/lua-resty-upload/issues/21在 2016年1月15日 下午2:27,xiaooloong <xiaooo...@gmail.com>写道:ngx.exit()When status >= 200 (i.e., ngx.HTTP_OK and above), it will interrupt the execution of the current request and return status code to nginx.感觉是这里的问题在 2016年1月15日星期五 UTC+8下午1:31:00,Binger写道:.lua 中,就是使用了upload,然后read后解析成功后 ngx.exit(ngx.OK)nginx_conf中就是 location ~ { include "uwsgi ..."; access_by_lua_file xx.lua; proxy_pass http://xxx;}在 2016年1月15日星期五 UTC+8上午11:58:01,mbb写道:你是怎么做转发的?能提供一个代码片段说明下吗?在 2016年1月15日 上午11:25,姜德斌 <bing...@gmail.com>写道:我想做的功能:1.使用nginx+lua做基础签名认证,类似按照所有post或者get的k-v排序后加上一段秘钥做hash验证2.通过后将所有client的请求原样转到另外一个服务目前用了upload,问题出在读取后,再做转发后,到了另外一个服务上,数据就全没了· 请问怎么解决这个问题呢~lua只是做验证,通过后希望所有client的请求都不会丢失~ -- -- --
Hello我这里测试是没有问题的哦nginx.conf location /body { content_by_lua_block { ngx.req.read_body() local body = ngx.req.get_body_data() ngx.say("body in proxy: ", body) } } location /test { access_by_lua_block { local len = ngx.req.get_headers()["content-length"] local sock = ngx.req.socket() local body = sock:receive(len) ngx.log(ngx.ERR, "access in main: ", body, ", content-length: ", len) ngx.req.init_body(len) ngx.req.append_body(body) ngx.req.finish_body() } rewrite ^ /body break; proxy_pass http://127.0.0.1/body; }执行结果:curl "http://127.0.0.1:80/test/" -i -X POST -d "data"HTTP/1.1 200 OKServer: openresty/1.9.7.1Date: Fri, 22 Jan 2016 08:06:40 GMTContent-Type: application/octet-streamContent-Length: 20Connection: keep-alivebody in proxy: data在 2016年1月22日 下午1:34,Binger <bing...@gmail.com>写道:哈哈,这个是我发的~ 最后也没有得到解决,目前我们的方式是,有文件的时候,我们把参数放到querystring中,post的body中不再放置key-value的数据~在 2016年1月15日星期五 UTC+8下午3:15:19,doujiang写道:Hello,如果这个不是你发的话,我想你可以看看https://github.com/openresty/lua-resty-upload/issues/21在 2016年1月15日 下午2:27,xiaooloong <xiaooo...@gmail.com>写道:ngx.exit()When status >= 200 (i.e., ngx.HTTP_OK and above), it will interrupt the execution of the current request and return status code to nginx.感觉是这里的问题在 2016年1月15日星期五 UTC+8下午1:31:00,Binger写道:.lua 中,就是使用了upload,然后read后解析成功后 ngx.exit(ngx.OK)nginx_conf中就是 location ~ { include "uwsgi ..."; access_by_lua_file xx.lua; proxy_pass http://xxx;}在 2016年1月15日星期五 UTC+8上午11:58:01,mbb写道:你是怎么做转发的?能提供一个代码片段说明下吗?在 2016年1月15日 上午11:25,姜德斌 <bing...@gmail.com>写道:我想做的功能:1.使用nginx+lua做基础签名认证,类似按照所有post或者get的k-v排序后加上一段秘钥做hash验证2.通过后将所有client的请求原样转到另外一个服务目前用了upload,问题出在读取后,再做转发后,到了另外一个服务上,数据就全没了· 请问怎么解决这个问题呢~lua只是做验证,通过后希望所有client的请求都不会丢失~ -- -- --
这种方式之前是了解过,但是毕竟更改了原始的body
重新构造了一次,并且我们只是做验证用,文件不去关心它,感谢你的提议,我试下这种解析方式,评估下结果~ 非常感谢帮助~
在 2016年1月22日星期五 UTC+8下午4:07:58,doujiang写道:Hello我这里测试是没有问题的哦nginx.conf location /body { content_by_lua_block { ngx.req.read_body() local body = ngx.req.get_body_data() ngx.say("body in proxy: ", body) } } location /test { access_by_lua_block { local len = ngx.req.get_headers()["content-length"] local sock = ngx.req.socket() local body = sock:receive(len) ngx.log(ngx.ERR, "access in main: ", body, ", content-length: ", len) ngx.req.init_body(len) ngx.req.append_body(body) ngx.req.finish_body() } rewrite ^ /body break; proxy_pass http://127.0.0.1/body; }执行结果:curl "http://127.0.0.1:80/test/" -i -X POST -d "data"HTTP/1.1 200 OKServer: openresty/1.9.7.1Date: Fri, 22 Jan 2016 08:06:40 GMTContent-Type: application/octet-streamContent-Length: 20Connection: keep-alivebody in proxy: data在 2016年1月22日 下午1:34,Binger <bing...@gmail.com>写道:哈哈,这个是我发的~ 最后也没有得到解决,目前我们的方式是,有文件的时候,我们把参数放到querystring中,post的body中不再放置key-value的数据~在 2016年1月15日星期五 UTC+8下午3:15:19,doujiang写道:Hello,如果这个不是你发的话,我想你可以看看https://github.com/openresty/lua-resty-upload/issues/21在 2016年1月15日 下午2:27,xiaooloong <xiaooo...@gmail.com>写道:ngx.exit()When status >= 200 (i.e., ngx.HTTP_OK and above), it will interrupt the execution of the current request and return status code to nginx.感觉是这里的问题在 2016年1月15日星期五 UTC+8下午1:31:00,Binger写道:.lua 中,就是使用了upload,然后read后解析成功后 ngx.exit(ngx.OK)nginx_conf中就是 location ~ { include "uwsgi ..."; access_by_lua_file xx.lua; proxy_pass http://xxx;}在 2016年1月15日星期五 UTC+8上午11:58:01,mbb写道:你是怎么做转发的?能提供一个代码片段说明下吗?在 2016年1月15日 上午11:25,姜德斌 <bing...@gmail.com>写道:我想做的功能:1.使用nginx+lua做基础签名认证,类似按照所有post或者get的k-v排序后加上一段秘钥做hash验证2.通过后将所有client的请求原样转到另外一个服务目前用了upload,问题出在读取后,再做转发后,到了另外一个服务上,数据就全没了· 请问怎么解决这个问题呢~lua只是做验证,通过后希望所有client的请求都不会丢失~ -- -- -- --
Hello,在 2016年1月22日 下午5:01,Binger <bing...@gmail.com>写道:这种方式之前是了解过,但是毕竟更改了原始的body哈哈,我想这样描述应该是不准确的吧,正如我给出的示例,依然保持了内容的一致性(以免有别人误解哈) 重新构造了一次,并且我们只是做验证用,文件不去关心它,感谢你的提议,我试下这种解析方式,评估下结果~ 非常感谢帮助~至于你的应用,能换一个更低成本的方式确实更加合适 :) 在 2016年1月22日星期五 UTC+8下午4:07:58,doujiang写道:Hello我这里测试是没有问题的哦nginx.conf location /body { content_by_lua_block { ngx.req.read_body() local body = ngx.req.get_body_data() ngx.say("body in proxy: ", body) } } location /test { access_by_lua_block { local len = ngx.req.get_headers()["content-length"] local sock = ngx.req.socket() local body = sock:receive(len) ngx.log(ngx.ERR, "access in main: ", body, ", content-length: ", len) ngx.req.init_body(len) ngx.req.append_body(body) ngx.req.finish_body() } rewrite ^ /body break; proxy_pass http://127.0.0.1/body; }执行结果:curl "http://127.0.0.1:80/test/" -i -X POST -d "data"HTTP/1.1 200 OKServer: openresty/1.9.7.1Date: Fri, 22 Jan 2016 08:06:40 GMTContent-Type: application/octet-streamContent-Length: 20Connection: keep-alivebody in proxy: data在 2016年1月22日 下午1:34,Binger <bing...@gmail.com>写道:哈哈,这个是我发的~ 最后也没有得到解决,目前我们的方式是,有文件的时候,我们把参数放到querystring中,post的body中不再放置key-value的数据~在 2016年1月15日星期五 UTC+8下午3:15:19,doujiang写道:Hello,如果这个不是你发的话,我想你可以看看https://github.com/openresty/lua-resty-upload/issues/21在 2016年1月15日 下午2:27,xiaooloong <xiaooo...@gmail.com>写道:ngx.exit()When status >= 200 (i.e., ngx.HTTP_OK and above), it will interrupt the execution of the current request and return status code to nginx.感觉是这里的问题在 2016年1月15日星期五 UTC+8下午1:31:00,Binger写道:.lua 中,就是使用了upload,然后read后解析成功后 ngx.exit(ngx.OK)nginx_conf中就是 location ~ { include "uwsgi ..."; access_by_lua_file xx.lua; proxy_pass http://xxx;}在 2016年1月15日星期五 UTC+8上午11:58:01,mbb写道:你是怎么做转发的?能提供一个代码片段说明下吗?在 2016年1月15日 上午11:25,姜德斌 <bing...@gmail.com>写道:我想做的功能:1.使用nginx+lua做基础签名认证,类似按照所有post或者get的k-v排序后加上一段秘钥做hash验证2.通过后将所有client的请求原样转到另外一个服务目前用了upload,问题出在读取后,再做转发后,到了另外一个服务上,数据就全没了· 请问怎么解决这个问题呢~lua只是做验证,通过后希望所有client的请求都不会丢失~ -- -- -- --