core/corehttp: gateway_handler: Redirect to path with trailing slash when showing a directory's index.html

This commit is contained in:
Matt Bell 2015-01-27 00:21:42 -08:00 committed by Juan Batiz-Benet
parent df97b968a1
commit 58d401c3b0

View File

@ -144,6 +144,11 @@ func (i *gatewayHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
foundIndex := false
for _, link := range nd.Links {
if link.Name == "index.html" {
if urlPath[len(urlPath)-1] != '/' {
http.Redirect(w, r, urlPath+"/", 302)
return
}
log.Debug("found index")
foundIndex = true
// return index page instead.