anchor.diff:                                   ns_audit_cfg:set_global(Values),
                                    reply(Req, 200)
                            end, Req, validate_settings_audit(Args)).
  +
  +nth_path_tail(Path, N) when N > 0 ->
  +    nth_path_tail(path_tail(Path), N-1);
  +nth_path_tail(Path, 0) ->
  +    Path.
  +
  +path_tail([$/|[$/|_] = Path]) ->
  +    path_tail(Path);
  +path_tail([$/|Path]) ->
  +    Path;
  +path_tail([_|Rest]) ->
  +    path_tail(Rest).
  +
  +drop_rest_prefix(Path) ->
  +    [$/ | path_tail(Path)].
  
positive.code: 
  start_link(Options) ->
      {AppRoot, Options1} = get_option(approot, Options),
      Loop = fun (Req) ->
                     ?MODULE:loop(Req, AppRoot)
             end,
      case mochiweb_http:start_link([{loop, Loop} | Options1]) of
          {ok, Pid} -> {ok, Pid};
  
negative.code:                          ["sampleBuckets"] -> {auth_ro, fun handle_sample_buckets/1};
                           ["_metakv" | _] ->
                               {auth, fun menelaus_metakv:handle_get/2, [Path]};
                           [RestPrefix, "ui" | _] ->
                               {done, menelaus_pluggable_ui:maybe_serve_file(
                                        RestPrefix, Plugins, Req,
                                        nth_path_tail(Path, 2))};
                           [RestPrefix | _] ->
                               case menelaus_pluggable_ui:is_plugin(RestPrefix, Plugins) of
                                   true ->
                                       {auth,
                                        fun (PReq) ->
                                                menelaus_pluggable_ui:proxy_req(
                                                  RestPrefix, drop_rest_prefix(Path),
                                                  Plugins, PReq)
                                        end};
                                   false ->
                                       {done, menelaus_util:serve_file(
                                                Req, Path, AppRoot,
                                                [{"Cache-Control", "max-age=10"}])}
                               end
                       end;
                   'POST' ->
                       case PathTokens of
  