You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
From what I can see people are using req.connection.encrypted or req.socket.encrypted to check it the request is http or https but I cannot find any reference to this in the documentation.
Is this the way to do it or is there another way? I cannot find anyone that actually knows :)
The text was updated successfully, but these errors were encountered:
It's document here: https://nodejs.org/api/tls.html#tlssocketencrypted.
When it's https, tls is used instead of net, that's why encrypted comes from here (and so encrypted is undefined when it's http, because net doesn't define this property).
Landed here because I had the same question. Would it be possible to reopen this until a note can be added to request.socket to say that it will be net.socket when the protocol is http and tls.socket when the protocol is https?
Affected URL(s)
https://nodejs.org/api/net.html#class-netsocket
Description of the problem
From what I can see people are using
req.connection.encrypted
orreq.socket.encrypted
to check it the request ishttp
orhttps
but I cannot find any reference to this in the documentation.Is this the way to do it or is there another way? I cannot find anyone that actually knows :)
The text was updated successfully, but these errors were encountered: