<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html><body style='font-size: 10pt; font-family: Verdana,Geneva,sans-serif'>
<p> </p>
<p>11.11.2015 19:17, Julien FROMENT wrote:</p>
<blockquote type="cite" style="padding-left:5px; border-left:#1010ff 2px solid; margin-left:5px">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size: 11pt; font-family: 'Calibri','sans-serif'; color: #666699;">Thanks for the reply,</span></p>
</div>
</blockquote>
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: #1f497d;"><!-- o ignored -->Welcome :)</span></p>
</div>
<blockquote type="cite" style="padding-left:5px; border-left:#1010ff 2px solid; margin-left:5px">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size: 11pt; font-family: 'Calibri','sans-serif'; color: #666699;">Using post_action could work, if we can sent to the @after_request_location enough reliable information. </span></p>
<p class="MsoNormal"><span style="font-size: 11pt; font-family: 'Calibri','sans-serif'; color: #666699;">Can we use the all the variable documented in the ngx_http_core_module (<a href="http://nginx.org/en/docs/http/ngx_http_core_module.html#variables"><span style="color: #666699;">http://nginx.org/en/docs /http/ngx_http_core_module.html#variables</span></a>) ? Are there any other variables that we could use?</span></p>
</div>
</blockquote>
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: #1f497d;">Yes, and your own specified <span style="font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: #1f497d;">also </span>(or some from custom modules).</span></p>
<p class="MsoNormal"><span style="font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: #1f497d;"><span style="font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: #1f497d;">Here is a more large list of all variables - http://nginx.org/en/docs/varindex.html</span></span></p>
<p class="MsoNormal"><span style="font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: #1f497d;">And if you want to use some values returned from upstream you should get a variables beginning with "upstream_...".<br />For example, if you need a http-header "X_MY_VAR", you should get <span style="font-family: courier new,courier;">$upstream_http_x_my_var</span>.<br />If you need a cookie value "example", you can get <span style="font-family: courier new,courier;"><span style="font-size: 11pt; color: #1f497d;">$upstream_</span>cookie_example</span> etc. For http status of response use <code>$upstream_status</code>. Here is the list of it all - http://nginx.org/en/docs/http/ngx_http_upstream_module.html#var_upstream_addr<br /></span></p>
</div>
<blockquote type="cite" style="padding-left:5px; border-left:#1010ff 2px solid; margin-left:5px">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size: 11pt; font-family: 'Calibri','sans-serif'; color: #666699;">Although, I am a bit concerned by your comment "possibly not recommended to use", could we clarify what you mean or what lead you to think it is not recommended?</span></p>
</div>
</blockquote>
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: #1f497d;">Well, you can read my small discussion with unambiguous answer about this from a nginx developer - https://www.mail-archive.com/nginx-devel@nginx.org/msg03680.html </span></p>
<p class="MsoNormal"><span style="font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: #1f497d;">I will keep this feature in my own bundles (and in my own forks) - no matter what some nginx developers say about this. <br />But ... it is my decision about.</span></p>
<p class="MsoNormal"><span style="font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: #1f497d;">In any case, I believe it is not very complex to create a similar functionality as (replacement) module, if "post_action" will be removed later from nginx standard bundle.</span></p>
</div>
<blockquote type="cite" style="padding-left:5px; border-left:#1010ff 2px solid; margin-left:5px">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size: 11pt; font-family: 'Calibri','sans-serif'; color: #666699;">Rergard,</span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: #666699;">Julien</span></p>
</div>
</blockquote>
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: #1f497d;">Regards,<br />Serg G. Brester (sebres)<br /></span></p>
</div>
<blockquote type="cite" style="padding-left:5px; border-left:#1010ff 2px solid; margin-left:5px">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: #1f497d;"> </span></p>
<div>
<div style="border: none; border-top: solid #B5C4DF 1.0pt; padding: 3.0pt 0cm 0cm 0cm;">
<p class="MsoNormal"><strong><span style="font-size: 10.0pt; font-family: 'Tahoma','sans-serif';">From:</span></strong><span style="font-size: 10.0pt; font-family: 'Tahoma','sans-serif';"> Sergey Brester [mailto:serg.brester@sebres.de] <br /><strong>Sent:</strong> Tuesday, November 10, 2015 2:30 PM<br /><strong>To:</strong> nginx-devel@nginx.org<br /><strong>Cc:</strong> Julien FROMENT<br /><strong>Subject:</strong> Re: Tracking sent responses</span></p>
</div>
</div>
<p><span style="font-size: 10.0pt; font-family: 'Verdana','sans-serif';">Hi,</span></p>
<p><span style="font-size: 10.0pt;">I'm sure you can do that using <span class="roman">on-board "equipment"</span> of nginx, without deep integrating to the nginx (without write of own module).</span></p>
<p><span style="font-size: 10.0pt; font-family: 'Verdana','sans-serif';">You can use for this a "post_action", something like:<br /><br /> post_action @after_request_location;</span></p>
<p><span style="font-size: 10.0pt; font-family: 'Verdana','sans-serif';">But (There is always a "but":), according to my last known stand:</span></p>
<p><span style="font-size: 10.0pt; font-family: 'Verdana','sans-serif';">- the feature "post_action" is asynchronously;<br />- the feature is not documentated (and possibly not recommended to use);- if location "executed" in post_action uses upstreams (fcgi, proxy_pass, etc.), it will always breaks a keepalive connection to the upstream channel (possibly fixed, but I've missed).</span></p>
<p><span style="font-size: 10.0pt; font-family: 'Verdana','sans-serif';">Regards,<br />sebres.</span></p>
<p><span style="font-size: 10.0pt; font-family: 'Verdana','sans-serif';">Am 10.11.2015 19:51, schrieb Julien FROMENT:</span></p>
<blockquote style="border: none; border-left: solid #1010FF 1.5pt; padding: 0cm 0cm 0cm 4.0pt; margin-left: 3.75pt; margin-top: 5.0pt; margin-bottom: 5.0pt;">
<div>
<p class="MsoNormal" style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;">Hello,</p>
<p class="MsoNormal" style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;">We would like to use Nginx to keep track of exactly what part of an upstream's server response was sent over a socket. Nginx could call an API asynchronously with the number of bytes sent over the socket for a given request.</p>
<p class="MsoNormal" style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;">&nbs p;</p>
<p class="MsoNormal" style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;">Here is the pseudo code:</p>
<p class="MsoNormal" style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"> -- Client send a request</p>
<p class="MsoNormal" style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"> -- Nginx processes the request and send it to the upstream</p>
<p class="MsoNormal" style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"> ...</p>
<p class="MsoNormal" style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"> -- The upstream returns the response</p>
<p class="MsoNormal" style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"> -- Nginx sends the response to the client</p>
<p class="MsoNormal" style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"> -- Nginx calls Async API with the number of bytes sent</p>
<p class="MsoNormal" style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;">I read a little bit of "Emiller's Guide To Nginx Module Development", and I think we could write a Handler that provide some tracking information. But I am unsure if it is possible to hook it at a low enough level for our needs.</p>
<p class="MsoNormal" style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;">Are there any expert on this mailing list that could provide us consulting services and guide us through the development of such functionality?</p>
<p class="MsoNormal" style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;">Thanks in advance!</p>
<p class="MsoNormal" style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;">Julien</p>
</div>
<pre>#</pre>
<pre>" Ce courriel et les documents qui lui sont joints peuvent contenir des</pre>
<pre>informations confidentielles ou ayant un caractè privéS'ils ne vous sont</pre>
<pre>pas destiné nous vous signalons qu'il est strictement interdit de les</pre>
<pre>divulguer, de les reproduire ou d'en utiliser de quelque maniè que ce</pre>
<pre>soit le contenu. Si ce message vous a é transmis par erreur, merci d'en</pre>
<pre>informer l'expéteur et de supprimer imméatement de votre systè</pre>
<pre>informatique ce courriel ainsi que tous les documents qui y sont attaché"</pre>
<pre> ******</pre>
<pre>" This e-mail and any attached documents may contain confidential or</pre>
<pre>proprietary information. If you are not the intended recipient, you are</pre>
<pre>notified that any dissemination, copying of this e-mail and any attachments</pre>
<pre>thereto or use of their contents by any means whatsoever is strictly</pre>
<pre>prohibited. If you have received this e-mail in error, please advise the</pre>
<pre>sender immediately and delete this e-mail and all attached documents</pre>
<pre>from your computer system."</pre>
<pre>#</pre>
<p class="MsoNormal"><span style="font-size: 10.0pt; font-family: 'Verdana','sans-serif';"> </span></p>
<pre>_______________________________________________</pre>
<pre>nginx-devel mailing list</pre>
<pre><a href="mailto:nginx-devel@nginx.org">nginx-devel@nginx.org</a></pre>
<pre><a href="http://mailman.nginx.
org/mailman/listinfo/nginx-devel">http://mailman.nginx.org/mailman/listinfo/nginx-devel</a></pre>
</blockquote>
</div>
<pre>#
" Ce courriel et les documents qui lui sont joints peuvent contenir des
informations confidentielles ou ayant un caractè privéS'ils ne vous sont
pas destiné nous vous signalons qu'il est strictement interdit de les
divulguer, de les reproduire ou d'en utiliser de quelque maniè que ce
soit le contenu. Si ce message vous a é transmis par erreur, merci d'en
informer l'expéteur et de supprimer imméatement de votre systè
informatique ce courriel ainsi que tous les documents qui y sont attaché"
******
" This e-mail and any attached documents may contain confidential or
proprietary information. If you are not the intended recipient, you are
notified that any dissemination, copying of this e-mail and any attachments
thereto or use of their contents by any means whatsoever is strictly
prohibited. If you have received this e-mail in error, please advise the
sender immediately and delete this e-mail and all attached documents
from your computer system."
#
</pre>
</blockquote>
</body></html>