<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<div name="messageBodySection">
<div dir="auto">Also, just to be clear, you’re saying that r.args should include parsed POST vars? Obviously it includes query string/GET vars. That works. But the values in the POST body do not show up in the args output. And again, I basically see nothing coming up in the output for variables.<br />
<br />
This:<br />
<br />
# Pass PHP requests to PHP-FPM<br />
location ~ \.php$ {<br />
<span style="white-space:pre"> limit_req zone=post_limit burst=5 nodelay;</span><br />
<span style="white-space:pre"> limit_req_status 429;</span><br />
<br />
<span style="white-space:pre"> set $test 0;</span><br />
<span style="white-space:pre"> </span><br />
<span style="white-space:pre"> add_header Content-Type text/plain;</span><br />
<span style="white-space:pre"> js_content dbadmin.access;</span><br />
}<br />
<br />
<span style="color:#cd8d4e;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px">function</span><span style="color:#ffffff;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px"> </span><span style="color:#a97a8c;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px">access</span><span style="color:#ffffff;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px">(</span><em style="color:#d9dbfc;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px">r</em><span style="color:#ffffff;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px">){ </span><span style="font-size: 12px"><br /></span><span style="font-size: 12px"><br /></span><span style="color:#ffffff;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px"> </span><span style="color:#cd8d4e;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px">var</span><span style="color:#ffffff;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px"> </span><span style="color:#d9dbfc;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px">jObj</span><span style="color:#ffffff;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px"> </span><span style="color:#c4bc3c;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px">=</span><span style="color:#ffffff;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px"> </span><span style="color:#d19a66;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px">JSON</span><span style="color:#c4bc3c;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px">.</span><span style="color:#d1673a;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px">stringify</span><span style="color:#ffffff;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px">(</span><span style="color:#d9dbfc;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px">r</span><span style="color:#c4bc3c;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px">.</span><span style="color:#d9dbfc;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px">args</span><span style="color:#ffffff;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px">) </span><span style="color:#c4bc3c;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px">+</span><span style="color:#ffffff;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px"> </span><span style="color:#b9c87f;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px">'\n'</span><span style="color:#ffffff;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px">;</span><span style="font-size: 12px"><br /></span><span style="color:#ffffff;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px"> </span><span style="color:#d9dbfc;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px">jObj</span><span style="color:#ffffff;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px"> </span><span style="color:#c4bc3c;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px">=</span><span style="color:#ffffff;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px"> </span><span style="color:#d19a66;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px">JSON</span><span style="color:#c4bc3c;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px">.</span><span style="color:#d1673a;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px">stringify</span><span style="color:#ffffff;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px">(</span><span style="color:#d9dbfc;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px">r</span><span style="color:#c4bc3c;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px">.</span><span style="color:#d9dbfc;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px">variables</span><span style="color:#ffffff;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px">);</span><span style="font-size: 12px"><br /></span><span style="font-size: 12px"><br /></span><span style="color:#ffffff;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px"> </span><span style="color:#cd8d4e;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px">try</span><span style="color:#ffffff;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px"> {</span><span style="font-size: 12px"><br /></span><span style="color:#ffffff;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px"> </span><span style="color:#cd8d4e;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px">var</span><span style="color:#ffffff;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px"> </span><span style="color:#d9dbfc;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px">parseJSON</span><span style="color:#ffffff;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px"> </span><span style="color:#c4bc3c;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px">=</span><span style="color:#ffffff;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px"> </span><span style="color:#d19a66;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px">JSON</span><span style="color:#c4bc3c;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px">.</span><span style="color:#d1673a;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px">parse</span><span style="color:#ffffff;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px">(</span><span style="color:#d9dbfc;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px">jObj</span><span style="color:#ffffff;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px">);</span><span style="font-size: 12px"><br /></span><span style="color:#ffffff;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px"> } </span><span style="color:#cd8d4e;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px">catch</span><span style="color:#ffffff;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px"> (</span><span style="color:#d9dbfc;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px">err</span><span style="color:#ffffff;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px">) {</span><span style="font-size: 12px"><br /></span><span style="color:#ffffff;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px"> </span><span style="color:#d9dbfc;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px">r</span><span style="color:#c4bc3c;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px">.</span><span style="color:#a97a8c;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px">return</span><span style="color:#ffffff;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px">(</span><span style="color:#5286b7;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px">400</span><span style="color:#ffffff;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px">, </span><span style="color:#b9c87f;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px">'Cannot parse jObj'</span><span style="color:#ffffff;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px">);</span><span style="font-size: 12px"><br /></span><span style="color:#ffffff;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px"> </span><span style="color:#cd8d4e;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px">return</span><span style="color:#ffffff;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px">;</span><span style="font-size: 12px"><br /></span><span style="color:#ffffff;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px"> }</span><span style="font-size: 12px"><br /></span><span style="font-size: 12px"><br /></span><span style="color:#ffffff;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px"> </span><span style="color:#d9dbfc;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px">r</span><span style="color:#c4bc3c;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px">.</span><span style="color:#a97a8c;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px">return</span><span style="color:#ffffff;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px">(</span><span style="color:#5286b7;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px">200</span><span style="color:#ffffff;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px">, </span><span style="color:#d9dbfc;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px">jObj</span><span style="color:#ffffff;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px">);</span><span style="font-size: 12px"><br /></span><span style="font-size: 12px"><br /></span><span style="color:#ffffff;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px"> </span><span style="color:#cd8d4e;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px">return</span><span style="color:#ffffff;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px">;</span><span style="font-size: 12px"><br /></span><span style="color:#ffffff;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px">}</span><span style="font-size: 12px"><br /></span><span style="font-size: 12px"><br /></span><span style="color:#cd8d4e;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px">export</span><span style="color:#ffffff;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px"> </span><span style="color:#cd8d4e;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px">default</span><span style="color:#ffffff;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px"> {</span><span style="color:#d9dbfc;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px">access</span><span style="color:#ffffff;background-color:#383939;font-family:Menlo, Monaco, Courier New, monospace;font-size: 12px">}</span><span style="font-size: 12px"><br /></span><span style="font-size: 12px"><br /></span><span style="font-size: 12px"><br /></span><span style="color:#ffffff;background-color:#383939">Shows nothing. Just an empty JSON object like {}</span></div>
</div>
<div name="messageSignatureSection"><br />
<div class="matchFont"><br />
--<br />
Lance Dockins<br />
Minister of Magic<br />
WordKeeper<br />
Office: 405.585.2500<br />
Cell: 405.306.7401<br />
https://wordkeeper.com</div>
</div>
<div name="messageReplySection">On Aug 11, 2021, 10:44 PM -0500, Lance Dockins <lance@wordkeeper.com>, wrote:<br />
<blockquote type="cite" style="border-left-color: grey; border-left-width: thin; border-left-style: solid; margin: 5px 5px;padding-left: 10px;">
<div name="messageBodySection">
<div dir="auto">Something is definitely wrong here but I’ve stripped most of the more advanced configuration out of the vhost conf, removed all modules other than NJS, and set the Nginx compile to pretty much the most vanilla compile option set that I can to rule out the possibility of 3rd party interference with this. Nothing is having any impact on the args var output. For POST, it’s always an empty object. For GET, it’s always showing the query string vars in a key/value pair (if there are any). The variables and rawVariables objects always seem to be empty but I’m not setting any vars with NJS right now. I’m only setting those in Nginx.<br />
<br />
At this point, if you’re saying that it should be working, I’m inclined to think that I’ve discovered some sort of bug. Debug didn’t turn up anything unexpected. I’m not the most well versed person at parsing through debug logs but it all looked like expected stuff to me.<br />
<br />
Moreover, the config that I was using at the start of this conversation is a config that is working on multiple thousands of production websites on well over 100 servers that we care for with no issues whatsoever. Not to mention that that config works just fine with LuaJIT. The only difference was that we swapped out the LuaJIT hooks for NJS to see how that might work instead. But like I said, at this point, even with no 3rd party modules, no patches of any sort, very basic compile settings, and no fancy use of Nginx settings (e.g. extensive use of IF), it’s just not working.<br />
<br />
So either I have stumbled across some flaw in NJS or there’s a misunderstanding somewhere in the discussion.</div>
</div>
<div name="messageSignatureSection"><br />
<div class="matchFont"><br />
--<br />
Lance Dockins<br />
<br /></div>
</div>
<div name="messageReplySection">On Aug 11, 2021, 10:00 PM -0500, Lance Dockins <lance@wordkeeper.com>, wrote:<br />
<blockquote type="cite" style="border-left-color: grey; border-left-width: thin; border-left-style: solid; margin: 5px 5px;padding-left: 10px;">
<div name="messageBodySection">
<div dir="auto">Unfortunately, we can’t really use standard packages. We need extra modules. I’m recompiling and enabling debug now. The modules we’re using aren’t anything super abnormal and we might replace one of them with NJS at some point. All I know for sure is that this seems to work just fine with OpenResty’s LuaJIT integration/module. So it’s something that is different between NJS and that.<br />
<br />
Hopefully the debug will turn something up.</div>
</div>
<div name="messageSignatureSection"><br />
<div class="matchFont"><br />
--<br />
Lance Dockins<br />
<br /></div>
</div>
<div name="messageReplySection">On Aug 11, 2021, 9:57 PM -0500, Sergey A. Osokin <osa@freebsd.org.ru>, wrote:<br />
<blockquote type="cite" style="border-left-color: grey; border-left-width: thin; border-left-style: solid; margin: 5px 5px;padding-left: 10px;">On Wed, Aug 11, 2021 at 09:48:48PM -0500, Lance Dockins wrote:<br />
<blockquote type="cite">I’ll try recompiling nginx with that to see if that changes anything.<br /></blockquote>
<br />
I'd recommend to use official packages for Linux from the following URL,<br />
http://nginx.org/en/linux_packages.html<br />
<br />
<blockquote type="cite">In fact, even your code is returning nothing.<br /></blockquote>
<br />
That's definitely something wrong on your side. Please simplify the<br />
nginx configuration, remove all unnecessary directives.<br />
<br />
...<br />
<br />
<blockquote type="cite">When I submit a POST with vars, I still get an empty object in the response.<br /></blockquote>
<br />
A couple of suggestions:<br />
<br />
- Have you enabled debugging log? If so, could you share nginx-error.log.<br />
- How did you test the code? Here's my shell script:<br />
<br />
#!/bin/sh<br />
<br />
curl -v --data-binary @test.bin http://127.0.0.1:8080/test?foo=bar\&baz=1<br />
<br />
#EOF<br />
<br />
Please report when all suggested points are done, thanks.<br />
<br />
--<br />
Sergey<br />
_______________________________________________<br />
nginx mailing list<br />
nginx@nginx.org<br />
http://mailman.nginx.org/mailman/listinfo/nginx</blockquote>
</div>
</blockquote>
</div>
</blockquote>
</div>
</body>
</html>