Fix wildcard proxy body forwarding, simplify config example
authorStefan Gasser <redacted>
Fri, 16 Jan 2026 23:53:24 +0000 (00:53 +0100)
committerStefan Gasser <redacted>
Fri, 16 Jan 2026 23:53:24 +0000 (00:53 +0100)
config.example.yaml
src/routes/proxy.ts

index cc923d81e5ba4e6aba3d7c13a75e03529e2be8e0..d21ceb73e72eafbd424797bcbca75979e4d056c8 100644 (file)
@@ -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:
index 915b7584e8456e8f7c34d5f465a1727520a34460..e275d21eb117c00dc4398760cc2a5dd179209b7b 100644 (file)
@@ -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"),
     },
   });
git clone https://git.99rst.org/PROJECT