summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFuwn <[email protected]>2023-12-28 18:38:51 -0800
committerFuwn <[email protected]>2023-12-28 18:38:51 -0800
commitb05f78d65200794e1191208810453a577e1daa40 (patch)
tree4415dcaa92631196c207e529f7c567e3f5eca1af /src
parentfix(src): add origin header (diff)
downloaddue-proxy-b05f78d65200794e1191208810453a577e1daa40.tar.xz
due-proxy-b05f78d65200794e1191208810453a577e1daa40.zip
feat: always cors
Diffstat (limited to 'src')
-rw-r--r--src/index.js3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/index.js b/src/index.js
index 69041f0..8aa0863 100644
--- a/src/index.js
+++ b/src/index.js
@@ -14,7 +14,6 @@ async function handleRequest(request) {
// Initialize url and query
const url = new URL(request.url);
const query = url.search.split('?q=')[1];
- const origin = request.headers.get('Origin');
/*
* Rewrite request to point to API url. This also makes the request mutable
@@ -38,7 +37,7 @@ async function handleRequest(request) {
response = new Response(response.body, response);
// Set CORS headers
- response.headers.set('Access-Control-Allow-Origin', origin.includes('localhost') ? '*' : 'https://due.moe');
+ response.headers.set('Access-Control-Allow-Origin', 'https://due.moe');
// Append to/Add Vary header so browser will cache response correctly
response.headers.append('Vary', 'Origin');