|
@@ -78,8 +78,17 @@ func init() {
|
|
beego.Router(fmt.Sprintf("%s/config.js", config.ContextPath), &nginx_controller.ConfigController{})
|
|
beego.Router(fmt.Sprintf("%s/config.js", config.ContextPath), &nginx_controller.ConfigController{})
|
|
// portal static assets
|
|
// portal static assets
|
|
beego.SetStaticPath(config.ContextPath, "static/web")
|
|
beego.SetStaticPath(config.ContextPath, "static/web")
|
|
|
|
+
|
|
|
|
+ webPrefix := config.ContextPath
|
|
|
|
+ if !strings.HasSuffix(webPrefix, "/") {
|
|
|
|
+ webPrefix = webPrefix + "/"
|
|
|
|
+ }
|
|
|
|
+
|
|
beego.Get("/", func(ctx *context.Context) {
|
|
beego.Get("/", func(ctx *context.Context) {
|
|
- ctx.Redirect(301, fmt.Sprintf("%s/index.html", config.ContextPath))
|
|
|
|
|
|
+ ctx.Redirect(301, webPrefix)
|
|
|
|
+ })
|
|
|
|
+ beego.Get(config.ContextPath+"/*", func(ctx *context.Context) {
|
|
|
|
+ ctx.Redirect(301, webPrefix)
|
|
})
|
|
})
|
|
|
|
|
|
beego.ErrorHandler("404", func(writer http.ResponseWriter, request *http.Request) {
|
|
beego.ErrorHandler("404", func(writer http.ResponseWriter, request *http.Request) {
|