Welcome! Log In Create A New Profile

Advanced

Sharing data between Module and Filter

Posted by PsyKro 
Sharing data between Module and Filter
November 20, 2018 11:19AM
Good evening,

Let me first provide you the background from my incoming questions:

* I'm currently trying to write a module which would hook on the PRECONTENT phase. In this module i'd like to make requests to an upstream which return me a response that i'd like to store.
* In the CONTENT phase, everything should follow the configuration (mostly calling an upstream).
* Afterwards, a filter will be placed to modify the regular response (obtained from the CONTENT phase) with the information obtained from the PRECONTENT phase.

Now for the questions:

1 Is this design compliant with nginx philosophy ?
2 If the answer to the first question is NO...

I was thinking otherwise moving the things in PRECONTENT phase to a dedicated filter. BUT in that case, this filter must occur before the one which is manipulating the response. Is it possible ? Can you otherwise give me some tracks to follow ?

3 If the answer to the first question is YES...

I'm struggling in understanding how i can store the information from the PRECONTENT phase. I had in mind to store the response in a variable and use it in the filter. I don't understand the callback mechanism for the variables. Most module only registers GET callback, and if i look at for example upstream module, the variable is actually set in this callback. When is this callback called ?
Can you guide me through this by providing me some pointers to examples ?

Thanks for your help !

kR,

PsyKro
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 112
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready