mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-06 19:08:59 -05:00
[GH-ISSUE #15107] issue: we using the custom auth logic for auto login by passing the trusted header feature using the nginx proxy pass #56138
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @priyadharsan1403 on GitHub (Jun 18, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/15107
Check Existing Issues
Installation Method
Git Clone
Open WebUI Version
v0.3.11
Ollama Version (if applicable)
No response
Operating System
ubuntu 22.04
Browser (if applicable)
chrome
Confirmation
README.md.Expected Behavior
to header should pass to open webui post where it running 3001
Actual Behavior
my nginx script :
server {
listen 80;
listen [::]:80;
server_name subdomain.domain.com;
location /nexus_chat {
# Authentication
auth_request /auth-verify;
}
# Auth verification endpoint (internal)
location = /auth-verify {
internal;
proxy_pass http://127.0.0.1:5000/verify$is_args$args;
proxy_pass_request_body off;
proxy_set_header Content-Length "";
proxy_set_header X-Original-URI $request_uri;
proxy_set_header Authorization $http_authorization;
add_header X-Debug-User-ID $upstream_http_x_user_id always;
add_header X-Debug-Email $upstream_http_x_user_email always;
# TEMP: Log something to be sure it's hit
access_log /var/log/nginx/verify_access.log;
}
# Catch-all for any other /nexus_chat/* paths (rewrite to root for Open WebUI)
location / {
#rewrite ^/nexus_chat/(.*) /$1 break;
proxy_pass http://127.0.0.1:3001;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-User-Email $user_email;
proxy_set_header X-User-Name $user_name;
proxy_set_header X-User-ID $user_id;
proxy_set_header X-User-Org $user_org;
proxy_set_header X-API-Key $api_key;
}
}
my authmiddle script
const express = require('express');
const jwt = require('jsonwebtoken');
const { Pool } = require('pg');
const axios = require('axios');
const app = express();
const pool = new Pool({
connectionString: process.env.DATABASE_URL,
ssl: {
rejectUnauthorized: false, // Only use this in development
},
});
app.get('/verify', async (req, res) => {
try {
console.log('req.query:', req.query);
console.log('req.headers:', req.headers);
console.log('req.body:', req.body);
} catch (error) {
console.error('Auth verify error:', error);
res.status(401).send('Invalid token');
}
});
async function ensureWebUIUser(user, userId, orgId) {
const webuiUserId =
user_${userId}_org_${orgId};const base = 'http://open-webui:8080/api/v1';
const headers = {
Authorization:
Bearer ${process.env.WEBUI_API_KEY}};
try {
// Check if user exists
await axios.get(
${base}/users/${webuiUserId}, { headers });} catch (err) {
const status = err.response?.status;
console.log(
User lookup returned status ${status});if (status !== 404) {
console.error('Error checking user:', err.message);
return;
}
}
}
app.listen(3000, () => {
console.log('Auth middleware server running on port 3000');
});
docker setup :
open-webui:
image: ghcr.io/open-webui/open-webui:main
container_name: nexus-chat-webui
ports:
- "3001:8080"
environment:
Steps to Reproduce
like this subdomain.domain.com?token=hjsdjhkadjhjkj
here is the isssue unable to pass the header
Logs & Screenshots
{
"detail": "Your provider has not provided a trusted header. Please contact your administrator for assistance."
}
Additional Information
No response
@tjbck commented on GitHub (Jun 18, 2025):
Unable to reproduce, keep us updated.