Skip to content

Commit

Permalink
fix pipethrough of headers
Browse files Browse the repository at this point in the history
  • Loading branch information
dholms committed Mar 7, 2024
1 parent 5aec85f commit b4211ea
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions packages/pds/src/pipethrough.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@ export const parseProxyHeader = async (
return { did, serviceUrl }
}

const HEADERS_TO_FORWARD = [
'accept-language',
'content-type',
'atproto-labelers',
]

export const createUrlAndHeaders = async (
ctx: AppContext,
req: express.Request,
Expand All @@ -115,10 +121,13 @@ export const createUrlAndHeaders = async (
const headers = requester
? (await ctx.serviceAuthHeaders(requester, aud)).headers
: {}
// forward accept-language header to upstream services
headers['accept-language'] = req.headers['accept-language']
headers['content-type'] = req.headers['content-type']
headers['atproto-labelers'] = req.headers['atproto-labelers']
// forward select headers to upstream services
for (const header of HEADERS_TO_FORWARD) {
const val = req.headers[header]
if (val) {
headers[header] = val
}
}
return { url, headers }
}

Expand Down

0 comments on commit b4211ea

Please sign in to comment.