Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

feat(web): add public collection routes to next config and proxy

Richie McIlroy8ddbacd5342c
diff --git a/apps/web/next.config.mjs b/apps/web/next.config.mjs
index b1c37b1a5..b30c4d6c3 100644
--- a/apps/web/next.config.mjs
+++ b/apps/web/next.config.mjs
@@ -98,6 +98,16 @@ const nextConfig = {
},
],
},
+ {
+ source: "/c/:collectionId",
+ destination: "/c/:collectionId",
+ has: [
+ {
+ type: "host",
+ value: "(?!cap.so|cap.link).*",
+ },
+ ],
+ },
];
},
async redirects() {
diff --git a/apps/web/proxy.ts b/apps/web/proxy.ts
index 36ee15452..2bd79a183 100644
--- a/apps/web/proxy.ts
+++ b/apps/web/proxy.ts
@@ -44,6 +44,7 @@ export async function proxy(request: NextRequest) {
if (
!(
path.startsWith("/s/") ||
+ path.startsWith("/c/") ||
path.startsWith("/middleware") ||
path.startsWith("/dashboard") ||
path.startsWith("/onboarding") ||
@@ -69,7 +70,7 @@ export async function proxy(request: NextRequest) {
const webUrl = new URL(serverEnv().WEB_URL).hostname;
try {
- if (!path.startsWith("/s/")) {
+ if (!(path.startsWith("/s/") || path.startsWith("/c/"))) {
const url = new URL(request.url);
url.hostname = webUrl;
return NextResponse.redirect(url);