Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Commit 3718562

Browse files
authored
Allow HEAD requests on non-dotcom instances (#57562)
This fixes #56624 by implementing the solution described in this comment: https://github.com/sourcegraph/sourcegraph/issues/56624#issuecomment-1720266424 Before the copy&paste allegations: I independently arrived at the same thing after trying to figure out where the loop comes from.
1 parent 5f2fbbb commit 3718562

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

cmd/frontend/internal/app/ui/router.go

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -138,20 +138,15 @@ func newRouter() *mux.Router {
138138
r := mux.NewRouter()
139139
r.StrictSlash(true)
140140

141-
homeRouteMethods := []string{"GET"}
142-
if envvar.SourcegraphDotComMode() {
143-
homeRouteMethods = append(homeRouteMethods, "HEAD")
144-
}
145-
146141
// Top-level routes.
147-
r.Path("/").Methods(homeRouteMethods...).Name(routeHome)
142+
r.Path("/").Methods(http.MethodGet, http.MethodHead).Name(routeHome)
148143
r.PathPrefix("/threads").Methods("GET").Name(routeThreads)
149144
r.Path("/search").Methods("GET").Name(routeSearch)
150145
r.Path("/search/badge").Methods("GET").Name(routeSearchBadge)
151146
r.Path("/search/stream").Methods("GET").Name(routeSearchStream)
152147
r.Path("/search/console").Methods("GET").Name(routeSearchConsole)
153148
r.Path("/search/cody").Methods("GET").Name(routeCodySearch)
154-
r.Path("/sign-in").Methods("GET").Name(uirouter.RouteSignIn)
149+
r.Path("/sign-in").Methods(http.MethodGet, http.MethodHead).Name(uirouter.RouteSignIn)
155150
r.Path("/sign-up").Methods("GET").Name(uirouter.RouteSignUp)
156151
r.PathPrefix("/request-access").Methods("GET").Name(uirouter.RouteRequestAccess)
157152
r.Path("/unlock-account/{token}").Methods("GET").Name(uirouter.RouteUnlockAccount)

0 commit comments

Comments
 (0)