emqx / emqx-auth-http

EMQX HTTP Authentication/ACL Plugin
https://emqx.io/
Apache License 2.0
43 stars 47 forks source link

meaning of the %r parameter #251

Closed mlmarius closed 3 years ago

mlmarius commented 3 years ago

I have configured the http auth plugin like so

EMQX_AUTH__HTTP__AUTH_REQ__PARAMS: clientid=%c,username=%u,password=%P,protocol=%r

I was relying on the fact that if the connection is of type MQTT then protocol would be 'mqtt' or 'mqtts' and if the client connected from WebSocket then it would be 'ws' or 'wss' but now I notice that for the connections that are comming from my WebSocket clients to the 8083 port I still see the protocol mqtt. Shouldn't it have been ws ? Any way to let my http authorization API know if the client connected via mqtt or ws ?

HJianBo commented 3 years ago

The %r meaning the Client's Application Protocol instead of Transport layer protocol. It can be mqtt, coap, etc.

An alternative is to use %p to get the port that the client is connected to in order to infer the protocol of the transport layer it is accessing.

 - %p: sockport of server accepted