On Tue, May 22, 2012 at 6:57 PM, Tzury Bar Yochay <tz...@reblaze.com> wrote:
>> To short-circuit the processing flow, i.e., to finish the whole
>> request processing cycle in your Lua code running at the access phase,
>> you need to use ngx.exit(200) (or something like that) at the end of
>> your access_by_lua's Lua script, see
>
>
> thanks for clarification.
>
> so assume I want to handle the request (from client side) at access phase,
> and response (from back-end server) at content phase, is it possible?
>
If subrequests are involved here, then each (sub)request has its own
processing phases.
For example, if your main request (to /main) issues a subrequest (to
/sub) at access phase by calling ngx.location.capture(), then the
running phases looks like:
/main /sub
access
rewrite
access
content
access
content
That is, the access phase of /main will stay until the /sub completes
all of its own phases.
> (this approach make sense to me as I do not wish to replace the entire
> proxy capability with
> the lua function)
>
In your case, I think you should use content_by_lua instead of access_by_lua.
Regards,
-agentzh