From 0df383d1c053faba03a538340038e2aa05d7c187 Mon Sep 17 00:00:00 2001 From: Gregor Zurowski Date: Wed, 16 Sep 2026 11:31:13 +0200 Subject: [PATCH 1/2] Stop using CORS proxy for papers --- components/work/WorkDocument.tsx | 2 +- types/work.ts | 23 +++-------------------- 2 files changed, 4 insertions(+), 21 deletions(-) diff --git a/components/work/WorkDocument.tsx b/components/work/WorkDocument.tsx index 6c4e16107..16aff2a89 100644 --- a/components/work/WorkDocument.tsx +++ b/components/work/WorkDocument.tsx @@ -87,7 +87,7 @@ export const WorkDocument = ({ work, metadata }: WorkDocumentProps) => {
{work.pdfCopyrightAllowsDisplay ? ( setPdfUnavailable(true)} /> diff --git a/types/work.ts b/types/work.ts index a394b537f..81186596c 100644 --- a/types/work.ts +++ b/types/work.ts @@ -5,9 +5,7 @@ import { Topic, transformTopic } from './topic'; import { createTransformer, BaseTransformed } from './transformer'; import { Hub } from './hub'; import { NoteWithContent, transformNoteWithContent } from './note'; -import { ProxyService } from '../services/proxy.service'; import { stripHtml } from '../utils/stringUtils'; -import { transformUser, TransformedUser } from './user'; import { transformTip, Tip } from './tip'; import { transformProposalReview, type ProposalReview } from './aiPeerReview'; import type { FundingPool, GrantApplicationVisibility } from './grant'; @@ -74,10 +72,6 @@ export type DocumentVersion = { export interface FormatType { type: string; url: string; - /** - * This is a proxied URL for internal use (e.g., to avoid CORS issues when rendering PDFs). - */ - internalUrl?: string; } export interface Work { @@ -320,21 +314,10 @@ export const transformWork = createTransformer((raw) => { doi: raw.doi, journal: transformJournal(raw), formats: raw.file - ? [...(raw.formats || []), { type: 'PDF', url: raw.file, internalUrl: raw.file }] + ? [...(raw.formats || []), { type: 'PDF', url: raw.file }] : raw.pdf_url - ? [ - ...(raw.formats || []), - { - type: 'PDF', - url: raw.pdf_url, - internalUrl: ProxyService.generateProxyUrl(raw.pdf_url), - }, - ] - : (raw.formats || []).map((format: FormatType) => ({ - ...format, - internalUrl: - format.type === 'PDF' ? ProxyService.generateProxyUrl(format.url) : undefined, - })), + ? [...(raw.formats || []), { type: 'PDF', url: raw.pdf_url }] + : raw.formats || [], license: raw.pdf_license, pdfCopyrightAllowsDisplay: raw.pdf_copyright_allows_display, figures: raw.first_preview From 18413c9562e8e18d05b7399e9fb5a962959482f0 Mon Sep 17 00:00:00 2001 From: Gregor Zurowski Date: Wed, 16 Sep 2026 11:31:41 +0200 Subject: [PATCH 2/2] Remove proxy service --- services/proxy.service.ts | 21 --------------------- 1 file changed, 21 deletions(-) delete mode 100644 services/proxy.service.ts diff --git a/services/proxy.service.ts b/services/proxy.service.ts deleted file mode 100644 index 01fc61c7d..000000000 --- a/services/proxy.service.ts +++ /dev/null @@ -1,21 +0,0 @@ -const getBaseUrl = (): string => { - if (process.env.VERCEL_ENV === 'production') { - return 'https://proxy.prod.researchhub.com'; - } - return 'https://proxy.staging.researchhub.com'; -}; - -export const ProxyService = { - getBaseUrl, - generateProxyUrl: (url: string): string => { - // Don't proxy ResearchHub CDN URLs - if (url && url.includes('researchhub')) { - return url; - } - - const baseUrl = getBaseUrl(); - return `${baseUrl}/proxy?url=${encodeURIComponent(url)}`; - }, -}; - -export default ProxyService;