diff --git a/public/opensearch.xml b/public/opensearch.xml
deleted file mode 100644
index 7a9bc99..0000000
--- a/public/opensearch.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
- Perplexica
- Search with Perplexica AI
- UTF-8
- /favicon.ico
-
-
-
diff --git a/src/app/api/opensearch/route.ts b/src/app/api/opensearch/route.ts
new file mode 100644
index 0000000..438e15d
--- /dev/null
+++ b/src/app/api/opensearch/route.ts
@@ -0,0 +1,26 @@
+import { NextResponse } from 'next/server';
+
+export async function GET(request: Request) {
+ // Get the host from the request
+ const url = new URL(request.url);
+ const origin = url.origin;
+
+ // Create the OpenSearch XML with the correct origin
+ const opensearchXml = `
+
+ Perplexica
+ Search with Perplexica AI
+ Perplexica is a powerful AI-driven search engine that understands your queries and delivers relevant results.
+ UTF-8
+ ${origin}/favicon.ico
+
+
+`;
+
+ // Return the XML with the correct content type
+ return new NextResponse(opensearchXml, {
+ headers: {
+ 'Content-Type': 'application/opensearchdescription+xml',
+ },
+ });
+}
diff --git a/src/app/layout.tsx b/src/app/layout.tsx
index f90be8a..06ee1f2 100644
--- a/src/app/layout.tsx
+++ b/src/app/layout.tsx
@@ -31,7 +31,7 @@ export default function RootLayout({
rel="search"
type="application/opensearchdescription+xml"
title="Perplexica Search"
- href="/opensearch.xml"
+ href="/api/opensearch"
/>