$ssl_protocol in nodejs POST requests after 1.9.4

Reinis Rozitis r at roze.lv
Sat May 8 16:33:07 UTC 2021


Hello.
I have a strange issue where for a POST request having any form data Nginx
after version 1.9.4 doesn't log $ssl_protocol (or any other $ssl_*)
variable.


I have a configured custom accesslog:

log_format main '... $ssl_protocol $ssl_cipher $server_port';

A simple script ( for example from
https://nodejs.dev/learn/make-an-http-post-request-using-nodejs ) will
generate following accesslog entry with all the variables being empty:

[08/May/2021:19:11:50 +0300] ...  "axios/0.21.1" - - 443


The moment you remove the form data everything is being logged:

[08/May/2021:19:10:58 +0300] ...  HTTP/1.1" 200 772 "-" "axios/0.21.1"
TLSv1.2 ECDHE-RSA-AES128-GCM-SHA256 443


I tried to debug the requests and see the difference (besides
Content-Length) but I wasn't able to pinpoint the issue. 
I tried various nodejs libraries ('request' etc) and also native approach -
all produce same results - empty POST requests are fine, the moment you post
any form data the $ssl_* become empty.
I can't reproduce it with curl - tried varios requests with and without
data, with chunked encoding etc - everything is being logged as expected.


One could say that the problem is on the Node side - but what has changed
between 1.9.4 and 1.9.5 that breaks the logging? 

Maybe someone has any suggestions or ideas how to investigate this further?

Wbr




More information about the nginx mailing list