Prevent HEAD requests to a sub-path from infinite redirects (#28285)

* adding test

```release-note
NONE
```

---------

Co-authored-by: Agniva De Sarker <agnivade@yahoo.co.in>
Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
Arya Khochare
2024-10-29 19:57:20 +05:30
коммит произвёл GitHub
родитель 3ac1c9821b
Коммит e0e5dbd36e
2 изменённых файлов: 9 добавлений и 1 удалений

Просмотреть файл

@@ -47,7 +47,7 @@ func (w *Web) InitStatic() {
w.MainRouter.PathPrefix("/static/").Handler(staticHandler)
w.MainRouter.Handle("/robots.txt", http.HandlerFunc(robotsHandler))
w.MainRouter.Handle("/unsupported_browser.js", http.HandlerFunc(unsupportedBrowserScriptHandler))
w.MainRouter.Handle("/{anything:.*}", w.NewStaticHandler(root)).Methods(http.MethodGet)
w.MainRouter.Handle("/{anything:.*}", w.NewStaticHandler(root)).Methods(http.MethodGet, http.MethodHead)
// When a subpath is defined, it's necessary to handle redirects without a
// trailing slash. We don't want to use StrictSlash on the w.MainRouter and affect