使用http认证连接emqx可以登录但是输出错误日志

环境信息

  • EMQX 版本:4.4.9
  • 操作系统及版本:
  • 其他

问题描述

使用http认证连接emqx可以登录但是输出错误日志

2022-10-17T15:48:56.274552+08:00 [error] Platform1@58.217.30.142:23232 [Hooks] Failed to execute {emqx_auth_http,check,[#{auth => #{headers => [{<<“content-type”>>,“application/x-www-form-urlencoded”}],method => post,params => [{“clientid”,"%c"},{“username”,"%u"},{“password”,"%P"},{“ipaddress”,"%a"}],path => “/mqtt/auth”,pool_name => ‘emqx_auth_http/auth_req’,pool_opts => [{host,{192,168,1,12}},{port,9000},{enable_pipelining,100},{pool_size,32},{pool_type,random},{connect_timeout,5000},{retry,5},{retry_timeout,1000},{transport_opts,[{ipv6_probe,true}]}],timeout => 5000,url => “http://192.168.1.12:9000/mqtt/auth”},super => #{headers => [],method => post,params => [{“clientid”,"%c"},{“username”,"%u"}],path => “/mqtt/superuser”,pool_name => ‘emqx_auth_http/super_req’,pool_opts => [{host,{192,168,1,12}},{port,9000},{enable_pipelining,100},{pool_size,32},{pool_type,random},{connect_timeout,5000},{retry,5},{retry_timeout,1000},{transport_opts,[{ipv6_probe,true}]}],timeout => 5000,url => “http://192.168.1.12:9000/mqtt/superuser”}}]}: {error,{case_clause,undefined},[{emqx_auth_http_cli,request,6,[{file,“emqx_auth_http_cli.erl”},{line,35}]},{emqx_auth_http,is_superuser,2,[{file,“emqx_auth_http.erl”},{line,83}]},{emqx_auth_http,check,3,[{file,“emqx_auth_http.erl”},{line,43}]},{emqx_hooks,safe_execute,2,[{file,“emqx_hooks.erl”},{line,207}]},{emqx_hooks,do_run_fold,3,[{file,“emqx_hooks.erl”},{line,186}]},{emqx_access_control,authenticate,1,[{file,“emqx_access_control.erl”},{line,43}]},{emqx_channel,auth_connect,2,[{file,“emqx_channel.erl”},{line,1351}]},{emqx_misc,pipeline,3,[{file,“emqx_misc.erl”},{line,155}]},{emqx_channel,handle_in,2,[{file,“emqx_channel.erl”},{line,305}]},{emqx_connection,with_channel,3,[{file,“emqx_connection.erl”},{line,694}]},{emqx_connection,process_msg,2,[{file,“emqx_connection.erl”},{line,394}]},{emqx_connection,process_msg,2,[{file,“emqx_connection.erl”},{line,400}]},{emqx_connection,handle_recv,3,[{file,“emqx_connection.erl”},{line,358}]},{proc_lib,wake_up,3,[{file,“proc_lib.erl”},{line,236}]}]}

配置文件及日志

你的header里面什么都没有。至少得有:
content-type ,值可以取:application/x-www-form-urlencoded 和application/json

确实是我配置文件没有取消注释导致的