misc: Allow CORS in vercel.json

This commit is contained in:
Xyphyn committed 2023-07-04 13:31:23 -07:00
1 parent 16ff3055b0
commit 3bc9c67bc4
2 files changed
+22 -2

No files matched your search

-2
View File
@@ -14,7 +14,6 @@ export async function handle({ event, resolve }) {
// annoying hack to fix lemmy's CORS
if (event.url.pathname.startsWith('/cors')) {
// cut off the 1st slash (empty), and remove the /cors
event.request.headers.delete('origin')
event.request.headers.delete('host')
@@ -58,7 +57,6 @@ export async function handle({ event, resolve }) {
)
}
} catch (error) {
console.error(error)
return new Response(
JSON.stringify({
message: 'the proxy failed to fetch from server',
+22
View File
@@ -0,0 +1,22 @@
{
"headers": [
{
"source": "/cors/(.*)",
"headers": [
{ "key": "Access-Control-Allow-Credentials", "value": "true" },
{ "key": "Access-Control-Allow-Origin", "value": "*" },
{
"key": "Access-Control-Allow-Methods",
"value": "GET,OPTIONS,PATCH,DELETE,POST,PUT"
},
{
"key": "Access-Control-Allow-Headers",
"value": "X-CSRF-Token, X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version"
}
]
}
]
}