From: Stefan Gasser Date: Fri, 16 Jan 2026 23:53:24 +0000 (+0100) Subject: Fix wildcard proxy body forwarding, simplify config example X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=93512940744a5b6de2d7864a12172e6b7e9838d7;p=sgasser-llm-shield.git Fix wildcard proxy body forwarding, simplify config example --- diff --git a/config.example.yaml b/config.example.yaml index cc923d8..d21ceb7 100644 --- a/config.example.yaml +++ b/config.example.yaml @@ -21,16 +21,13 @@ providers: base_url: https://api.openai.com/v1 # api_key: ${OPENAI_API_KEY} # Optional fallback if client doesn't send auth header -# Local provider - only for route mode -# PII requests are sent here instead of the configured provider +# Local provider - only used when mode: route # Supports: ollama (native), openai (for vLLM, LocalAI, LM Studio, etc.) -# -# Uncomment for route mode: -# local: -# type: ollama # or "openai" for OpenAI-compatible servers -# base_url: http://localhost:11434 -# model: llama3.2 -# # api_key: ${LOCAL_API_KEY} # Only needed for OpenAI-compatible servers +local: + type: ollama + base_url: http://localhost:11434 + model: llama3.2 + # api_key: ${LOCAL_API_KEY} # Only needed for OpenAI-compatible servers # Masking settings (only for mask mode) masking: diff --git a/src/routes/proxy.ts b/src/routes/proxy.ts index 915b758..e275d21 100644 --- a/src/routes/proxy.ts +++ b/src/routes/proxy.ts @@ -600,16 +600,16 @@ function formatMessagesForLog(messages: ChatMessage[]): string { } /** - * Wildcard proxy - forwards all other /v1/* requests to the configured provider - * Supports: /models, /embeddings, /audio/*, /images/*, /files/*, etc. - * Must be defined AFTER specific routes to avoid matching them first + * Wildcard proxy for /models, /embeddings, /audio/*, /images/*, etc. */ proxyRoutes.all("/*", (c) => { const { openai } = getRouter().getProvidersInfo(); const path = c.req.path.replace(/^\/openai\/v1/, ""); return proxy(`${openai.baseUrl}${path}`, { + ...c.req, headers: { + "Content-Type": c.req.header("Content-Type"), Authorization: c.req.header("Authorization"), }, });