bskyweb: middleware to remove trailing / (#598)
parent
bf3ea67442
commit
9a91b0c538
|
@ -92,6 +92,12 @@ func serve(cctx *cli.Context) error {
|
||||||
e.Renderer = NewRenderer("templates/", &bskyweb.TemplateFS, debug)
|
e.Renderer = NewRenderer("templates/", &bskyweb.TemplateFS, debug)
|
||||||
e.HTTPErrorHandler = customHTTPErrorHandler
|
e.HTTPErrorHandler = customHTTPErrorHandler
|
||||||
|
|
||||||
|
// redirect trailing slash to non-trailing slash.
|
||||||
|
// all of our current endpoints have no trailing slash.
|
||||||
|
e.Use(middleware.RemoveTrailingSlashWithConfig(middleware.TrailingSlashConfig{
|
||||||
|
RedirectCode: http.StatusFound,
|
||||||
|
}))
|
||||||
|
|
||||||
// configure routes
|
// configure routes
|
||||||
e.GET("/robots.txt", echo.WrapHandler(staticHandler))
|
e.GET("/robots.txt", echo.WrapHandler(staticHandler))
|
||||||
e.GET("/static/*", echo.WrapHandler(http.StripPrefix("/static/", staticHandler)))
|
e.GET("/static/*", echo.WrapHandler(http.StripPrefix("/static/", staticHandler)))
|
||||||
|
|
Loading…
Reference in New Issue