diff --git a/packages/plugins/@nocobase/plugin-api-doc/src/client/Document.tsx b/packages/plugins/@nocobase/plugin-api-doc/src/client/Document.tsx index fbbce4527..c7ee6806f 100644 --- a/packages/plugins/@nocobase/plugin-api-doc/src/client/Document.tsx +++ b/packages/plugins/@nocobase/plugin-api-doc/src/client/Document.tsx @@ -16,6 +16,9 @@ const Documentation = () => { const { data: urls } = useRequest<{ data: { name: string; url: string }[] }>({ url: 'swagger:getUrls' }); const requestInterceptor = (req) => { if (!req.headers['Authorization']) { + const match = location.pathname.match(/^\/apps\/([^/]*)\//); + // multi apps need to set X-App header + req.headers['X-App'] = match?.[1] || 'main'; req.headers['Authorization'] = `Bearer ${apiClient.auth.getToken()}`; } return req;