diff --git a/package.json b/package.json index d42693e..5650e5c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "meteorproxy", - "version": "1.0.1", + "version": "1.0.2", "description": "The modern interception proxy you've been waiting for", "type": "module", "main": "./lib/index.cjs", @@ -13,7 +13,7 @@ "build": "tsx build.ts", "demo": "tsx server.ts", "demo:lite": "tsx server.ts --no-build", - "release": "tsc && biome check . --write npm run build && npm publish --access public", + "release": "tsc && biome check . --write && npm run build && npm publish --access public", "check": "biome check . --write", "typecheck": "tsc" }, diff --git a/src/meteor.config.js b/src/meteor.config.js index c367bac..633cba6 100644 --- a/src/meteor.config.js +++ b/src/meteor.config.js @@ -1,4 +1,4 @@ -/** @type {import('./types').Config} */ +/** @type {import('meteorproxy').Config} */ const config = { prefix: '/route/', codec: self.__meteor$codecs.xor, diff --git a/src/worker.ts b/src/worker.ts index 6a983fa..b15958e 100644 --- a/src/worker.ts +++ b/src/worker.ts @@ -34,10 +34,14 @@ class MeteorServiceWorker { return new Response(response.body) } + const fetchHead = new Headers(request.headers) + fetchHead.set('cookie', (await getCookies(url.host)).join('; ')) + fetchHead.set('host', url.host) + fetchHead.set('origin', url.origin) let response: BareResponseFetch = await this.client.fetch(url, { method: request.method, body: request.body, - headers: request.headers, + headers: fetchHead, credentials: 'omit', mode: request.mode === 'cors' ? request.mode : 'same-origin', cache: request.cache,