Skip to content

Commit 64c8217

Browse files
committed
Update allowed hosts
1 parent eec2796 commit 64c8217

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "openworkers-api",
3-
"version": "1.3.3",
3+
"version": "1.3.4",
44
"license": "MIT",
55
"module": "src/index.ts",
66
"type": "module",

src/routes/cors-proxy.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ import { Hono } from 'hono';
1212
* for browser-based requests (WebContainers).
1313
*/
1414

15-
const ALLOWED_HOSTS = ['api.anthropic.com', 'console.anthropic.com'];
15+
// Allow all Anthropic subdomains
16+
const ALLOWED_HOST_PATTERN = /^(.+\.)?anthropic\.com$/;
1617

1718
// Allowed origins for CORS (dashboard domains + WebContainers)
1819
const ALLOWED_ORIGINS = [
@@ -56,8 +57,8 @@ corsProxy.all('/*', async (c) => {
5657

5758
console.log(`[cors-proxy] ${c.req.method} ${targetPath} -> ${targetHost}`);
5859

59-
// Validate target host
60-
if (!ALLOWED_HOSTS.includes(targetHost)) {
60+
// Validate target host (must be *.anthropic.com)
61+
if (!ALLOWED_HOST_PATTERN.test(targetHost)) {
6162
return c.json({ error: 'Host not allowed' }, 403);
6263
}
6364

0 commit comments

Comments
 (0)