apisix icon indicating copy to clipboard operation
apisix copied to clipboard

request help: 请问apisix代码中有发送http请求封装好的方法吗

Open StretchV opened this issue 5 years ago • 2 comments

Issue description

我的需求是:每一个请求A过来后要先发送另一个请求B,从而获取B的结果然后根据这个结果自定义一个插件(插件的作用是:判断请求B的结果,向A请求加不同的头信息),想质询确认一下现有的代码中有发送http请求的函数吗,或者这种场景有推荐其他类的做法吗,redirect+proxy_rewrite插件的组合可以实现吗,因为我查看网上信息lua发送http请求貌似需要引入socket包,不太确定会不会对apisix造成影响

Environment

  • apisix version (cmd: apisix version): v2.3
  • OS (cmd: uname -a):
  • OpenResty / Nginx version (cmd: nginx -V or openresty -V):
  • etcd version, if have (cmd: run curl http://127.0.0.1:9090/v1/server_info to get the info from server-info API):
  • apisix-dashboard version, if have:

StretchV avatar Feb 23 '21 10:02 StretchV

@StretchV If you are writing your own plugins or tweaking APISIX, just use lua-resty-http. It's easy to use and won't add any dependencies.

tokers avatar Feb 23 '21 10:02 tokers

ok thank you very much

StretchV avatar Feb 23 '21 11:02 StretchV