strip base path

This commit is contained in:
Frederik Löffert 2019-11-22 18:11:40 +01:00
parent 313dcdb339
commit f1df8688b0
3 changed files with 10 additions and 7 deletions

View File

@ -5,12 +5,12 @@ import (
"path/filepath"
"time"
"github.com/sirupsen/logrus"
"github.com/foomo/neosproxy/cache/content/store/fs"
"github.com/foomo/neosproxy/client/cms"
"github.com/foomo/neosproxy/config"
"github.com/foomo/neosproxy/logging"
"github.com/foomo/neosproxy/proxy"
"github.com/sirupsen/logrus"
)
func main() {

View File

@ -17,8 +17,9 @@ type ObserverInterface interface {
// Config struct definition
type Config struct {
Proxy struct {
Address string
Token string
Address string
Token string
BasePath string
}
Neos Neos
Cache Cache
@ -77,8 +78,9 @@ type ObserverWebhook struct {
type configFile struct {
Proxy struct {
Address string
Token string
Address string
Token string
BasePath string
}
Neos struct {
URL string `json:"url" yaml:"url"`

View File

@ -4,7 +4,7 @@ import (
"crypto/subtle"
"net/http"
"github.com/auth0/go-jwt-middleware"
jwtmiddleware "github.com/auth0/go-jwt-middleware"
"github.com/foomo/neosproxy/logging"
)
@ -14,7 +14,8 @@ import (
// Run a proxy
func (p *Proxy) Run() error {
return http.ListenAndServe(p.config.Proxy.Address, p.router)
handler := http.StripPrefix(p.config.Proxy.BasePath, p.router)
return http.ListenAndServe(p.config.Proxy.Address, handler)
}
//-----------------------------------------------------------------------------