Skip to content

armgit / E2B

Public Imported from GitHub
0

Open-source, secure environment with real-world tools for enterprise-grade agents.

Fix canonical links - non canonical page in sitemap

Jakub Novak9076179cbe15
diff --git a/apps/reverse-proxy/middleware.ts b/apps/reverse-proxy/middleware.ts
index 9736a3006..94a381edc 100644
--- a/apps/reverse-proxy/middleware.ts
+++ b/apps/reverse-proxy/middleware.ts
@@ -39,7 +39,7 @@ export async function middleware(req: NextRequest): Promise<NextResponse> {
const htmlBody = await res.text()
// !!! NOTE: Replace has intentionally not completed quotes to catch the rest of the path !!!
- const modifiedHtmlBody = replaceUrls(htmlBody, url.pathname, 'href="', '"')
+ const modifiedHtmlBody = replaceUrls(htmlBody, url.pathname, 'href="', '">')
return new NextResponse(modifiedHtmlBody, {
status: res.status,
diff --git a/apps/reverse-proxy/utils/replaceUrls.ts b/apps/reverse-proxy/utils/replaceUrls.ts
index c079fe3a2..a89f21eea 100644
--- a/apps/reverse-proxy/utils/replaceUrls.ts
+++ b/apps/reverse-proxy/utils/replaceUrls.ts
@@ -1,9 +1,9 @@
-export function replaceUrls(text: string, urlPathName: string, prefix: string = '', lastChar: string = ''): string {
- const pattern = lastChar ? `(?<url>${prefix}https://e2b-[^${lastChar}]*)/${lastChar}$` : `(?<url>${prefix}https://e2b-.*)/$`
+export function replaceUrls(text: string, urlPathName: string, prefix: string = '', suffix: string = ''): string {
+ const pattern = suffix ? `(?<url>${prefix}https://e2b-[^${suffix}]*)/${suffix}` : `(?<url>${prefix}https://e2b-.*)/$`
return text.replaceAll(
new RegExp(pattern, 'g'),
- (_, url) => url + lastChar,
+ (_, url) => url + suffix,
)
.replaceAll(
`${prefix}https://e2b-landing-page.framer.website`,