Skip to content

Commit

Permalink
chore: production origin hardcoded
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasRooney committed Jan 11, 2025
1 parent 08150c8 commit cb7d88c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions web/api/share.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ import { put } from "@vercel/blob";
import { createHash } from "crypto";

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

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

if (!origin || !origin.includes(AllowedOrigin)) {
if (!origin || (!origin.startsWith(AllowedOrigin) && !origin.startsWith(productionOrigin))) {
return new Response("Unauthorized", { status: 403 });
}

Expand Down

0 comments on commit cb7d88c

Please sign in to comment.