Skip to content

Commit

Permalink
Merge pull request #477 from victorcoder/redirect_to_dashboard
Browse files Browse the repository at this point in the history
Redirect to dashboard
  • Loading branch information
Victor Castell authored Dec 17, 2018
2 parents 5eb1e42 + 8695242 commit 1614017
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions dkron/dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,16 @@ func newCommonDashboardData(a *Agent, nodeName, path string) *commonDashboardDat

// dashboardRoutes registers dashboard specific routes on the gin RouterGroup.
func (a *Agent) DashboardRoutes(r *gin.RouterGroup) {
// If we are visiting from a browser redirect to the dashboard
r.GET("/", func(c *gin.Context) {
switch c.NegotiateFormat(gin.MIMEHTML) {
case gin.MIMEHTML:
c.Redirect(http.StatusMovedPermanently, "/"+dashboardPathPrefix+"/")
default:
c.AbortWithStatus(http.StatusNotFound)
}
})

r.GET("/static/*asset", servePublic)

dashboard := r.Group("/" + dashboardPathPrefix)
Expand Down

0 comments on commit 1614017

Please sign in to comment.