Hi, ngx.location.capture seems just use for internal sub-request. But any function can do https request to external API specifically for REST?
just found -> https://github.com/liseen/lua-resty-httpstudyingOn Tuesday, September 24, 2013 10:52:40 PM UTC+8, Payne Chu wrote:Hi, ngx.location.capture seems just use for internal sub-request. But any function can do https request to external API specifically for REST?
orz... seems no solution for https yet -> https://github.com/chaoslawful/lua-nginx-module/issues/178On Tuesday, September 24, 2013 11:18:16 PM UTC+8, Payne Chu wrote:just found -> https://github.com/liseen/lua-resty-httpstudyingOn Tuesday, September 24, 2013 10:52:40 PM UTC+8, Payne Chu wrote:Hi, ngx.location.capture seems just use for internal sub-request. But any function can do https request to external API specifically for REST?
Hello! On Tue, Sep 24, 2013 at 9:01 AM, Payne Chu wrote: > can ngx.location.catpure + proxy_pass to solve https issue ? > Yes, of course. The standard ngx_proxy module always supports https anyway. Regards, -agentzh
Hello! On Tue, Sep 24, 2013 at 6:37 PM, Payne Chu wrote: > Thanks Agentzh, > Don't capitalize my nick please. > Do you have any lua sample to show how ngx.location.capture + proxy_pass > work? > Just configure a location with ngx_proxy, and in another location, initiate a subrequest via the ngx.location.capture(). You can find a lot of examples in ngx_lua's (declarative) test suite, especially in the following test file: https://github.com/chaoslawful/lua-nginx-module/blob/master/t/020-subrequest.t#L25 > > it use $_uri to pass to proxy_pass. will it have any race condition issue? > Every Nginx request has its own Nginx variable copy. No race condition is possible here. You can check out my Nginx tutorials (still under work!) here for more details: http://openresty.org/download/agentzh-nginx-tutorials-en.html You can also find a lot of simple code examples there. Best regards, -agentzh