Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions dashboard/backend/router/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,29 @@ func Setup(cfg *config.Config) *http.ServeMux {
var openwebuiStaticProxy *httputil.ReverseProxy
if cfg.OpenWebUIURL != "" {
var err error
openwebuiStaticProxy, err = proxy.NewReverseProxy(cfg.OpenWebUIURL, "", false)
// Use forwardAuth=true to forward Authorization headers for API authentication
openwebuiStaticProxy, err = proxy.NewReverseProxy(cfg.OpenWebUIURL, "", true)
if err != nil {
log.Printf("Warning: failed to create OpenWebUI static proxy: %v", err)
openwebuiStaticProxy = nil
}
}

// OpenWebUI is not base-path aware; the Playground iframe loads it at /workspace (root),
// and it may redirect to /auth. These must be proxied to OpenWebUI (not served by the dashboard SPA).
if openwebuiStaticProxy != nil {
openwebuiRootProxy := func(w http.ResponseWriter, r *http.Request) {
if middleware.HandleCORSPreflight(w, r) {
return
}
openwebuiStaticProxy.ServeHTTP(w, r)
}
mux.HandleFunc("/auth", openwebuiRootProxy)
mux.HandleFunc("/auth/", openwebuiRootProxy)
mux.HandleFunc("/workspace", openwebuiRootProxy)
mux.HandleFunc("/workspace/", openwebuiRootProxy)
}

// Jaeger API proxy (needs to be set up early for the smart router below)
var jaegerAPIProxy *httputil.ReverseProxy
var jaegerStaticProxy *httputil.ReverseProxy
Expand Down Expand Up @@ -405,8 +421,9 @@ func Setup(cfg *config.Config) *http.ServeMux {
return
}
// Check if path is a known OpenWebUI API endpoint (even without referer)
// OpenWebUI uses /api/config for configuration
if openwebuiStaticProxy != nil && strings.HasPrefix(r.URL.Path, "/api/config") {
// OpenWebUI uses /api/config for configuration and /api/v1/ for auth/users
if openwebuiStaticProxy != nil && (strings.HasPrefix(r.URL.Path, "/api/config") ||
strings.HasPrefix(r.URL.Path, "/api/v1/")) {
log.Printf("Routing to OpenWebUI API: %s (by path pattern)", r.URL.Path)
openwebuiStaticProxy.ServeHTTP(w, r)
return
Expand Down
2 changes: 1 addition & 1 deletion dashboard/frontend/src/pages/PlaygroundPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const PlaygroundPage = () => {
<div className={styles.container}>
<div className={styles.iframeContainer}>
<iframe
src="/embedded/openwebui/"
src="/workspace"
className={styles.iframe}
title="Open WebUI Playground"
allowFullScreen
Expand Down
Loading