diff --git a/internal/outpost/proxy/proxy.go b/internal/outpost/proxy/proxy.go index 5ead7895f..e8343d903 100644 --- a/internal/outpost/proxy/proxy.go +++ b/internal/outpost/proxy/proxy.go @@ -22,6 +22,7 @@ import ( "github.com/oauth2-proxy/oauth2-proxy/providers" "goauthentik.io/api" "goauthentik.io/internal/utils/web" + staticWeb "goauthentik.io/web" log "github.com/sirupsen/logrus" ) @@ -255,11 +256,18 @@ func (p *OAuthProxy) ServeHTTP(rw http.ResponseWriter, req *http.Request) { p.AuthenticateOnly(rw, req) case path == p.UserInfoPath: p.UserInfo(rw, req) + case strings.HasPrefix(path, fmt.Sprintf("%s/static", p.ProxyPrefix)): + p.ServeStatic(rw, req) default: p.Proxy(rw, req) } } +func (p *OAuthProxy) ServeStatic(rw http.ResponseWriter, req *http.Request) { + staticFs := http.FileServer(http.FS(staticWeb.StaticDist)) + http.StripPrefix(fmt.Sprintf("%s/static", p.ProxyPrefix), staticFs).ServeHTTP(rw, req) +} + //UserInfo endpoint outputs session email and preferred username in JSON format func (p *OAuthProxy) UserInfo(rw http.ResponseWriter, req *http.Request) { diff --git a/internal/outpost/proxy/templates.go b/internal/outpost/proxy/templates.go index ca61f9ca3..607bfb577 100644 --- a/internal/outpost/proxy/templates.go +++ b/internal/outpost/proxy/templates.go @@ -4,25 +4,11 @@ import ( "html/template" log "github.com/sirupsen/logrus" + "goauthentik.io/internal/outpost/proxy/templates" ) func getTemplates() *template.Template { - t, err := template.New("foo").Parse(`{{define "error.html"}} - - -
-{{.Message}}
-Powered by authentik
- -{{end}}`) + t, err := template.New("foo").Parse(templates.ErrorTemplate) if err != nil { log.Fatalf("failed parsing template %s", err) } diff --git a/internal/outpost/proxy/templates/error.html b/internal/outpost/proxy/templates/error.html new file mode 100644 index 000000000..ed4e8744d --- /dev/null +++ b/internal/outpost/proxy/templates/error.html @@ -0,0 +1,65 @@ +{{define "error.html"}} + + + + + +