Hello!
On Tue, Jul 29, 2014 at 1:31 PM, Bjørnar Ness wrote:
> Hehe.. sorry. What I want to accomplish is:
>
> before request phase, (dont have r), make a internal request to a /location
> and use the response (string) to set some values in the original connection.
>
There is no such term like "internal request" in NGINX. You really
mean a subrequest to an internal location, right? As I've said, even
with hacks, it is not safe. Because other NGINX C modules serving the
subrequests usually assume a fully-initialized ngx_http_request_t
struct.
The best approach is to use the "fake request" mechanism as in
init_worker_by_lua and ngx.timer.at(), as I've said. And use cosockets
in such context instead of using subrequests. It's too hard to safely
use subrequests because the target NGINX C modules are out of control
and even a "fake request" has limitations that are too expensive to
emulate. And it's not worth it at all.
Regards,
-agentzh