Skip to content

Commit ca8f523

Browse files
adiologydevclaude
andcommitted
fix: add CORS support for browser requests
Add @elysiajs/cors plugin to enable cross-origin requests. This fixes ORB (Opaque Response Blocking) errors in Chrome when fetching images from different origins. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 702ab5e commit ca8f523

3 files changed

Lines changed: 6 additions & 0 deletions

File tree

bun.lock

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"typescript": "^5.9.3"
1818
},
1919
"dependencies": {
20+
"@elysiajs/cors": "^1.4.0",
2021
"@resvg/resvg-js": "^2.6.2",
2122
"elysia": "^1.4.18",
2223
"satori": "^0.18.3",

src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { cors } from "@elysiajs/cors";
12
import { Elysia } from "elysia";
23
import { config } from "./config";
34
import { healthRoutes } from "./routes/health";
@@ -11,6 +12,7 @@ if (config.cacheMode === "disk") {
1112
}
1213

1314
const app = new Elysia()
15+
.use(cors())
1416
.onError(({ error, code, set }) => {
1517
// Don't log Elysia's built-in NOT_FOUND errors (these are normal 404s)
1618
if (code === "NOT_FOUND") {

0 commit comments

Comments
 (0)