web/admin: fix invalid URLs in example proxy config

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2022-02-15 23:24:27 +01:00
parent 5d8c1aa0b0
commit 45f2c5bae7
3 changed files with 12 additions and 5 deletions

View File

@ -66,7 +66,10 @@ func (a *Application) handleRedirect(rw http.ResponseWriter, r *http.Request) {
}
func (a *Application) handleCallback(rw http.ResponseWriter, r *http.Request) {
s, _ := a.sessions.Get(r, constants.SeesionName)
s, err := a.sessions.Get(r, constants.SeesionName)
if err != nil {
a.log.WithError(err).Trace("failed to get session")
}
state, ok := s.Values[constants.SessionOAuthState]
if !ok {
a.log.Warning("No state saved in session")

View File

@ -3,7 +3,8 @@ package templates
import (
_ "embed"
"html/template"
"log"
log "github.com/sirupsen/logrus"
)
//go:embed error.html

View File

@ -92,16 +92,19 @@ export class ProxyProviderViewPage extends LitElement {
}
renderConfigTemplate(markdown: MarkdownDocument): MarkdownDocument {
const extHost = new URL(this.provider?.externalHost || "http://a");
// See website/docs/providers/proxy/forward_auth.mdx
if (this.provider?.mode === ProxyMode.ForwardSingle) {
markdown.html = markdown.html
.replaceAll("authentik.company", window.location.hostname)
.replaceAll("outpost.company", window.location.hostname)
.replaceAll("app.company", this.provider?.externalHost || "");
.replaceAll("http://outpost.company:9000", window.location.hostname)
.replaceAll("https://app.company", extHost.toString())
.replaceAll("app.company", extHost.hostname);
} else if (this.provider?.mode == ProxyMode.ForwardDomain) {
markdown.html = markdown.html
.replaceAll("authentik.company", window.location.hostname)
.replaceAll("outpost.company", this.provider?.externalHost || "");
.replaceAll("https://app.company", extHost.hostname)
.replaceAll("http://outpost.company:9000", extHost.toString());
}
return markdown;
}