diff --git a/internal/web/static.go b/internal/web/static.go index 4a8a0576a..6d81e7332 100644 --- a/internal/web/static.go +++ b/internal/web/static.go @@ -13,7 +13,8 @@ import ( func (ws *WebServer) configureStatic() { statRouter := ws.lh.NewRoute().Subrouter() - statRouter.Use(disableIndex) + indexLessRouter := statRouter.NewRoute().Subrouter() + indexLessRouter.Use(disableIndex) // Media files, always local fs := http.FileServer(http.Dir(config.G.Paths.Media)) var distHandler http.Handler @@ -25,7 +26,7 @@ func (ws *WebServer) configureStatic() { distFs = http.FileServer(http.Dir("./web/dist")) distHandler = http.StripPrefix("/static/dist/", distFs) authentikHandler = http.StripPrefix("/static/authentik/", http.FileServer(http.Dir("./web/authentik"))) - helpHandler = http.StripPrefix("/help/", http.FileServer(http.Dir("./website/help"))) + helpHandler = http.FileServer(http.Dir("./website/help/")) } else { statRouter.Use(ws.staticHeaderMiddleware) ws.log.Debug("Using packaged static files with aggressive caching") @@ -34,21 +35,21 @@ func (ws *WebServer) configureStatic() { authentikHandler = http.StripPrefix("/static", http.FileServer(http.FS(staticWeb.StaticAuthentik))) helpHandler = http.FileServer(http.FS(staticDocs.Help)) } - statRouter.PathPrefix("/static/dist/").Handler(distHandler) - statRouter.PathPrefix("/static/authentik/").Handler(authentikHandler) + indexLessRouter.PathPrefix("/static/dist/").Handler(distHandler) + indexLessRouter.PathPrefix("/static/authentik/").Handler(authentikHandler) // Prevent font-loading issues on safari, which loads fonts relatively to the URL the browser is on - statRouter.PathPrefix("/if/flow/{flow_slug}/assets").HandlerFunc(func(rw http.ResponseWriter, r *http.Request) { + indexLessRouter.PathPrefix("/if/flow/{flow_slug}/assets").HandlerFunc(func(rw http.ResponseWriter, r *http.Request) { vars := mux.Vars(r) disableIndex(http.StripPrefix(fmt.Sprintf("/if/flow/%s", vars["flow_slug"]), distFs)).ServeHTTP(rw, r) }) - statRouter.PathPrefix("/if/admin/assets").Handler(disableIndex(http.StripPrefix("/if/admin", distFs))) - statRouter.PathPrefix("/if/user/assets").Handler(disableIndex(http.StripPrefix("/if/user", distFs))) + indexLessRouter.PathPrefix("/if/admin/assets").Handler(http.StripPrefix("/if/admin", distFs)) + indexLessRouter.PathPrefix("/if/user/assets").Handler(http.StripPrefix("/if/user", distFs)) - statRouter.PathPrefix("/media/").Handler(http.StripPrefix("/media", fs)) + indexLessRouter.PathPrefix("/media/").Handler(http.StripPrefix("/media", fs)) - statRouter.PathPrefix("/if/help/").Handler(helpHandler) + statRouter.PathPrefix("/if/help/").Handler(http.StripPrefix("/if/help/", helpHandler)) statRouter.PathPrefix("/help").Handler(http.RedirectHandler("/if/help/", http.StatusMovedPermanently)) ws.lh.Path("/robots.txt").HandlerFunc(func(rw http.ResponseWriter, r *http.Request) { diff --git a/website/docusaurus.docs-only.js b/website/docusaurus.docs-only.js index f7b3aa0c6..17452bce3 100644 --- a/website/docusaurus.docs-only.js +++ b/website/docusaurus.docs-only.js @@ -4,7 +4,7 @@ module.exports = { title: "authentik", tagline: "Making authentication simple.", url: "https://goauthentik.io", - baseUrl: "/help/", + baseUrl: "/if/help/", onBrokenLinks: "throw", favicon: "img/icon.png", organizationName: "BeryJu",