core: allow CORS requests from *.opencode.ai subdomains
This commit is contained in:
parent
787f37b382
commit
7d2d87fa2c
1 changed files with 16 additions and 1 deletions
|
|
@ -104,7 +104,22 @@ export namespace Server {
|
||||||
timer.stop()
|
timer.stop()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.use(cors())
|
.use(
|
||||||
|
cors({
|
||||||
|
origin(input) {
|
||||||
|
if (!input) return
|
||||||
|
|
||||||
|
if (input.startsWith("http://localhost:")) return input
|
||||||
|
if (input.startsWith("http://127.0.0.1:")) return input
|
||||||
|
|
||||||
|
// *.opencode.ai (https only, adjust if needed)
|
||||||
|
if (/^https:\/\/([a-z0-9-]+\.)*opencode\.ai$/.test(input)) {
|
||||||
|
return input
|
||||||
|
}
|
||||||
|
return
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
)
|
||||||
.get(
|
.get(
|
||||||
"/global/health",
|
"/global/health",
|
||||||
describeRoute({
|
describeRoute({
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue