Skip to content

Commit

Permalink
#1370 Add http context to default page redirection
Browse files Browse the repository at this point in the history
  • Loading branch information
To-om committed May 27, 2020
1 parent e0df894 commit 002e6de
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions thehive/app/org/thp/thehive/TheHiveRouter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ package org.thp.thehive
import play.api.mvc._
import play.api.routing.sird._
import play.api.routing.{Router, SimpleRouter}
import play.api.{Environment, Logger, Mode}

import play.api.{Configuration, Environment, Logger, Mode}
import _root_.controllers.{Assets, ExternalAssets}
import com.google.inject.ProvidedBy
import javax.inject.{Inject, Provider, Singleton}
Expand All @@ -16,7 +15,8 @@ class TheHiveRouter @Inject() (
routerV1: v1.Router,
davRouter: dav.Router,
assets: AssetGetter,
actionBuilder: DefaultActionBuilder
actionBuilder: DefaultActionBuilder,
configuration: Configuration
) extends Provider[Router] {

lazy val logger: Logger = Logger(getClass)
Expand All @@ -25,7 +25,7 @@ class TheHiveRouter @Inject() (
routerV0.withPrefix("/api/") orElse // default version
davRouter.withPrefix("/fs") orElse
SimpleRouter {
case GET(p"/") => actionBuilder(Results.PermanentRedirect("/index.html"))
case GET(p"/") => actionBuilder(Results.PermanentRedirect(configuration.get[String]("play.http.context").stripSuffix("/") + "/index.html"))
case GET(p"/$file*") if !file.startsWith("api/") => assets.at(file)
}
}
Expand Down

0 comments on commit 002e6de

Please sign in to comment.