diff --git a/services/proxy.ts b/services/proxy.ts
index e8fe6721..1699a366 100644
--- a/services/proxy.ts
+++ b/services/proxy.ts
@@ -12,16 +12,26 @@ export default {
return new Response(null, {
status: 200,
headers: {
- "Access-Control-Allow-Origin": "*",
- "Access-Control-Allow-Methods": "GET,HEAD,POST,PUT,PATCH,DELETE,OPTIONS",
- "Access-Control-Allow-Headers": "*", // Or specify specific headers
- "Access-Control-Max-Age": "86400", // Cache preflight for 24 hours
+ "access-control-allow-origin": "*",
+ "access-control-allow-methods": "GET,HEAD,POST,PUT,PATCH,DELETE,OPTIONS",
+ "access-control-allow-headers": "*", // Or specify specific headers
+ "access-control-max-age": "86400", // Cache preflight for 24 hours
}
});
}
const headers = new Headers(request.headers);
- headers.set('User-Agent', 'Shakespeare Proxy ');
+ headers.set('user-agent', 'Shakespeare Proxy ');
+
+ // Remove forbidden browser headers that cause issues with some services
+ headers.delete('origin');
+ headers.delete('referer');
+
+ for (const header of headers.keys()) {
+ if (header.startsWith('sec-')) {
+ headers.delete(header);
+ }
+ }
const targetResponse = await fetch(target, {
method: request.method,
@@ -31,9 +41,9 @@ export default {
const response = new Response(targetResponse.body, targetResponse);
- response.headers.set("Access-Control-Allow-Origin", "*");
- response.headers.set("Access-Control-Allow-Methods", "GET,HEAD,POST,PUT,PATCH,DELETE,OPTIONS");
- response.headers.set("Access-Control-Allow-Headers", "*");
+ response.headers.set("access-control-allow-origin", "*");
+ response.headers.set("access-control-allow-methods", "GET,HEAD,POST,PUT,PATCH,DELETE,OPTIONS");
+ response.headers.set("access-control-allow-headers", "*");
return response;
}