fix(middleware): set baseURL to external host if provided (#369)

This commit is contained in:
twotobinary
2020-02-16 19:01:02 -08:00
committed by GitHub
parent df3d3d24f5
commit 776727140f
3 changed files with 18 additions and 7 deletions

View File

@@ -296,6 +296,11 @@ func BaseURLMiddleware(next http.Handler) http.Handler {
}
baseURL := scheme + "://" + r.Host
externalHost := config.GetExternalHost()
if externalHost != "" {
baseURL = externalHost
}
r = r.WithContext(context.WithValue(ctx, BaseURLCtxKey, baseURL))
next.ServeHTTP(w, r)