Forbid acces to directory root

This commit is contained in:
Kload 2013-10-20 18:45:10 +02:00
parent cec0ca6959
commit 0ddd88c409

View file

@ -154,6 +154,12 @@ function serve(uri)
rel_path = "/login.html" rel_path = "/login.html"
end end
-- Access to directory root: forbidden
if string.ends(rel_path, "/") then
return ngx.exit(403)
end
-- Try to get file content
content = read_file(script_path.."portal"..rel_path) content = read_file(script_path.."portal"..rel_path)
if not content then if not content then
return ngx.exit(ngx.HTTP_NOT_FOUND) return ngx.exit(ngx.HTTP_NOT_FOUND)