Skip to content

Commit cb7d88c

Browse files
committed
chore: production origin hardcoded
1 parent 08150c8 commit cb7d88c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

web/api/share.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@ import { put } from "@vercel/blob";
22
import { createHash } from "crypto";
33

44
const MAX_DATA_SIZE = 5 * 1024 * 1024; // 5MB
5-
const AllowedOrigin = process.env.VERCEL_URL ?? "http://localhost";
5+
const AllowedOrigin = process.env.VERCEL_URL ? `https://${process.env.VERCEL_URL}` : "http://localhost";
6+
const productionOrigin = "https://overlay.speakeasy.com";
67

78
export function POST(request: Request) {
89
const origin = request.headers.get("Origin");
910

10-
if (!origin || !origin.includes(AllowedOrigin)) {
11+
if (!origin || (!origin.startsWith(AllowedOrigin) && !origin.startsWith(productionOrigin))) {
1112
return new Response("Unauthorized", { status: 403 });
1213
}
1314

0 commit comments

Comments
 (0)