The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
check x frame options at link creation time
Steven Tey359cf84a24f1
diff --git a/content/help/how-to-create-link.mdx b/content/help/how-to-create-link.mdxindex 156753544a..5bb8fe1161 100644--- a/content/help/how-to-create-link.mdx+++ b/content/help/how-to-create-link.mdx@@ -138,10 +138,7 @@ When this is enabled, your short link will be shown in your users' browser addreA few caveats for the URL masking feature:1. This feature is only available for [Pro plans and above](pro-plan).-2. URL masking might not work for certain websites that have security measures in place to prevent this (e.g. `twitter.com`). Potential errors include:- - The domain redirects instead of rewriting- - Domain keeps redirecting (`ERR_TOO_MANY_REDIRECTS`)-3. For certain [Next.js](https://nextjs.org/) websites, URL masking might cause broken CSS styles (e.g. `ray.so`)+2. URL masking might not work for certain websites that have security measures in place to prevent this (e.g. `twitter.com`).## Password protectiondiff --git a/lib/api/links.ts b/lib/api/links.tsindex 7f2b19221a..a97fdcb9d4 100644--- a/lib/api/links.ts+++ b/lib/api/links.ts@@ -6,6 +6,7 @@ import { redis } from "#/lib/upstash";import { getParamsFromURL, nanoid, truncate, validKeyRegex } from "#/lib/utils";import { isReservedKey } from "#/lib/edge-config";import { NextApiRequest } from "next";+import { hasXFrameOptions } from "../middleware/utils";export async function getLinksForProject({projectId,@@ -213,7 +214,7 @@ export async function addLink(link: LinkProps) {const { utm_source, utm_medium, utm_campaign, utm_term, utm_content } =getParamsFromURL(url);- let [response, _] = await Promise.all([+ let [response, _, __] = await Promise.all([prisma.link.create({data: {...link,@@ -246,6 +247,7 @@ export async function addLink(link: LinkProps) {...(exat && { exat: exat as any }),},),+ rewrite && hasXFrameOptions(url),]);if (proxy && image) {const { secure_url } = await cloudinary.v2.uploader.upload(image, {@@ -348,6 +350,7 @@ export async function editLink(},exat ? { exat } : {},),+ rewrite && hasXFrameOptions(url),// if key is changed: rename resource in Cloudinary, delete the old key in Redis and change the clicks key name...(changedDomain || changedKey? [