diff --git a/src/pages/api/proxy.ts b/src/pages/api/proxy.ts
index ca1fd52..c4ce2c2 100644
--- a/src/pages/api/proxy.ts
+++ b/src/pages/api/proxy.ts
@@ -22,11 +22,11 @@ export default async function handler(
   try {
     const response = await fetch(link, { method: 'GET' })
     const contentType = response.headers.get('content-type')
-
-    if (contentType) {
+    if (contentType == 'application/pdf') {
+      res.setHeader('Content-Type', contentType)
+    } else {
       const filename = link.split('/').pop() ?? 'download'
       res.setHeader('Content-Disposition', `attachment; filename="${filename}"`)
-      res.setHeader('Content-Type', contentType)
     }
 
     if (response.ok) {
diff --git a/src/pages/api/validate.ts b/src/pages/api/validate.ts
index 0c8eb7c..9c15f42 100644
--- a/src/pages/api/validate.ts
+++ b/src/pages/api/validate.ts
@@ -14,18 +14,15 @@ export default async function handler(
     return res.status(400).json({ error: `Hiányzó paraméter: ${MissingParam}` })
   }
 
-  const secure = req.headers['x-forwarded-proto'] === 'https'
-  const protocol = secure ? 'https' : 'http'
-  const address = req.headers.host
-
-  if (!link.startsWith(`${protocol}://${address}`)) {
-    return res.status(400).json({ error: 'Érvénytelen link' })
-  }
-
   try {
-    const response = await fetch(link, { method: 'HEAD' })
-    const status = response.status
-    res.status(200).json({ status })
+    const { protocol, host } = new URL(link)
+    if (protocol && host) {
+      const response = await fetch(link, { method: 'HEAD' })
+      const status = response.status
+      res.status(200).json({ status })
+    } else {
+      return res.status(400).json({ error: 'Érvénytelen link' })
+    }
   } catch (error) {
     res.status(500).json({ error: 'Internal Server Error' })
   }