Add public OnlyOffice download endpoint to bypass auth middleware 401 issue
All checks were successful
Automated Container Build / build-and-push (push) Successful in 1m20s

This commit is contained in:
Elijah 2026-05-24 12:48:03 -07:00
parent a0353445d9
commit fd991a1d4b
3 changed files with 39 additions and 1 deletions

View file

@ -41,9 +41,11 @@ export default function OnlyOfficeEditor({ file, type, onClose }: OnlyOfficeEdit
// It's on the default bridge network and can reach the Unraid host IP, but NOT
// the public domain (hairpin NAT) or Docker DNS names (different network).
// Port 5827 is the frontend container (which proxies /api/* to the backend).
// We use dedicated public endpoints that validate tokens manually, bypassing
// the auth middleware which fails when requests come through the Next.js proxy.
const INTERNAL_URL = 'http://192.168.50.81:5827/api';
const fileUrl = `${INTERNAL_URL}/files/download/${encodeURIComponent(file.path)}?token=${downloadToken}`;
const fileUrl = `${INTERNAL_URL}/public/onlyoffice/download?path=${encodeURIComponent(file.path)}&token=${downloadToken}`;
const callbackUrl = `${INTERNAL_URL}/public/onlyoffice/callback?path=${encodeURIComponent(file.path)}&token=${downloadToken}`;
const baseConfig: any = {