Bladeren bron

Fix dashboard not showing data bug

turtled 8 jaren geleden
bovenliggende
commit
d9f14dacaf
2 gewijzigde bestanden met toevoegingen van 8 en 8 verwijderingen
  1. 7 7
      src/emqttd_http.erl
  2. 1 1
      src/emqttd_rest_api.erl

+ 7 - 7
src/emqttd_http.erl

@@ -26,7 +26,7 @@
 
 
 -import(proplists, [get_value/2, get_value/3]).
 -import(proplists, [get_value/2, get_value/3]).
 
 
--export([http_handler/0, handle_request/2, http_api/0]).
+-export([http_handler/0, handle_request/2, http_api/0, inner_handle_request/2]).
 
 
 -include("emqttd_internal.hrl").
 -include("emqttd_internal.hrl").
 
 
@@ -54,14 +54,14 @@ handle_request(Req, State) ->
         "/api/v2/auth" ->
         "/api/v2/auth" ->
             handle_request(Path, Req, State);
             handle_request(Path, Req, State);
         _ ->
         _ ->
-            Host = Req:get_header_value("Host"),
-            [_, Port] = string:tokens(Host, ":"),
-            case Port of
-                "18083" -> handle_request(Path, Req, State);
-                _ -> if_authorized(Req, fun() -> handle_request(Path, Req, State) end)
-            end
+            if_authorized(Req, fun() -> handle_request(Path, Req, State) end)
     end.
     end.
 
 
+inner_handle_request(Req, State) ->
+    Path = Req:get(path),
+    handle_request(Path, Req, State).
+
+
 handle_request("/api/v2/" ++ Url, Req, #state{dispatch = Dispatch}) ->
 handle_request("/api/v2/" ++ Url, Req, #state{dispatch = Dispatch}) ->
     Dispatch(Req, Url);
     Dispatch(Req, Url);
 
 

+ 1 - 1
src/emqttd_rest_api.erl

@@ -25,7 +25,7 @@
 -http_api({"^nodes/(.+?)/clients/(.+?)/?$", 'GET',client_list, []}).
 -http_api({"^nodes/(.+?)/clients/(.+?)/?$", 'GET',client_list, []}).
 -http_api({"^clients/(.+?)/?$", 'GET', client, []}).
 -http_api({"^clients/(.+?)/?$", 'GET', client, []}).
 -http_api({"^clients/(.+?)/?$", 'DELETE', kick_client, []}).
 -http_api({"^clients/(.+?)/?$", 'DELETE', kick_client, []}).
--http_api({"^clients/(.+?)/clean_acl_cache?$", 'DELETE', clean_acl_cache, [{<<"topic">>, binary}]}).
+-http_api({"^clients/(.+?)/clean_acl_cache?$", 'PUT', clean_acl_cache, [{<<"topic">>, binary}]}).
 
 
 -http_api({"^routes?$", 'GET', route_list, []}).
 -http_api({"^routes?$", 'GET', route_list, []}).
 -http_api({"^routes/(.+?)/?$", 'GET', route, []}).
 -http_api({"^routes/(.+?)/?$", 'GET', route, []}).