提交 58d401c3 作者: Matt Bell 提交者: Juan Batiz-Benet

core/corehttp: gateway_handler: Redirect to path with trailing slash when…

core/corehttp: gateway_handler: Redirect to path with trailing slash when showing a directory's index.html
上级 df97b968
......@@ -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.
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论