diff --git a/restful_router.go b/restful_router.go index cbb1f00a..9d33ed81 100644 --- a/restful_router.go +++ b/restful_router.go @@ -46,7 +46,13 @@ var routes = Routes{} // router func NewRouter() *mux.Router { router := mux.NewRouter().StrictSlash(true) - listenAddr := bot.config.Webserver.ListenAddress + var listenAddr string + + if common.ExtractPort(bot.config.Webserver.ListenAddress) == 80 { + listenAddr = common.ExtractHost(bot.config.Webserver.ListenAddress) + } else { + listenAddr = bot.config.Webserver.ListenAddress + } routes = Routes{ Route{ @@ -117,7 +123,7 @@ func NewRouter() *mux.Router { Path(route.Pattern). Name(route.Name). Handler(RESTLogger(route.HandlerFunc, route.Name)). - Host(common.ExtractHost(listenAddr)) + Host(listenAddr) } if bot.config.Profiler.Enabled { diff --git a/restful_server_test.go b/restful_server_test.go index 88a450c4..b3d7fc69 100644 --- a/restful_server_test.go +++ b/restful_server_test.go @@ -9,7 +9,6 @@ import ( "strings" "testing" - "github.com/thrasher-/gocryptotrader/common" "github.com/thrasher-/gocryptotrader/config" ) @@ -73,7 +72,7 @@ func TestValidHostRequest(t *testing.T) { if err != nil { t.Fatal(err) } - req.Host = common.ExtractHost(bot.config.Webserver.ListenAddress) + req.Host = bot.config.Webserver.ListenAddress resp := httptest.NewRecorder() NewRouter().ServeHTTP(resp, req)