anchor.diff:  	Req1 = cowboy_req:set_resp_header(<<"server">>, <<"NkPACKET">>, Req),
   	PathInfo = cowboy_req:path_info(Req),
   	FilePath = nklib_parse:fullpath(filename:join([DirPath|PathInfo])),
  +	%% Check we don't go outside DirPath
   	DirPathSize = byte_size(DirPath),
  -	%% Check we don't go outside DirPath
   	case FilePath of
   		<<DirPath:DirPathSize/binary, _/binary>> ->
  -			init_file(Req1, Opts, FilePath);
  +			IsDir = binary:last(cowboy_req:url(Req)) == $/,
  +			init_file(Req1, Opts, FilePath, IsDir);
   		_ ->
   			lager:warning("Webserver trying to access forbidden ~s", [FilePath]),
   			{cowboy_rest, Req1, {error, malformed}}
  
positive.code: 
  
  %% @private
  -spec init_file(cowboy_req:req(), opts(), binary()) -> 
  	{cowboy_rest, cowboy_req:req(), state()}.
  
  init_file(Req, Opts, FilePath) ->
  	case file:read_file_info(FilePath, [{time, universal}]) of
  		{ok, #file_info{type=directory}} ->
  			case maps:get(index_file, Opts, undefined) of
  				undefined -> 
  					lager:debug("Webserver sent forbidden directory ~s", [FilePath]),
  					{cowboy_rest, Req, {error, forbidden}};
  				Index ->
  					Url = join(Req, nklib_util:to_binary(Index)),
  					lager:debug("Webserver sent redirect to ~s", [Url]),
  					Req2 = cowboy_req:set_resp_header(<<"location">>, Url, Req),
  					Req3 = cowboy_req:reply(301, Req2),
  					{ok, Req3, Opts}
  			end;
  		{ok, #file_info{}=File} ->
  			lager:debug("Webserver found file ~s", [FilePath]),
  			{cowboy_rest, Req, {file, File, Opts#{path:=FilePath}}};
  
negative.code: %% ===================================================================
  
  
  
  
  % join(Req, Index) ->
  % 	Url1 = cowboy_req:url(Req),
  % 	Url2 = case byte_size(Url1) of
  % 		0 ->
  % 			<<"/">>;
  % 		Size ->
  % 			case binary:at(Url1, Size-1) of
  % 				$/ -> Url1;
  % 				_ -> <<Url1/binary, "/">>
  % 			end
  % 	end,
  % 	<<Url2/binary, Index/binary>>.