MCPcopy Create free account
hub / github.com/vercel/vercel / getProxyHeaders

Method getProxyHeaders

packages/cli/src/util/dev/server.ts:1502–1522  ·  view source on GitHub ↗

* Returns the request `headers` that will be sent to the Lambda.

(
    req: http.IncomingMessage,
    requestId: string,
    xfwd: boolean
  )

Source from the content-addressed store, hash-verified

1500 * Returns the request `headers` that will be sent to the Lambda.
1501 */
1502 getProxyHeaders(
1503 req: http.IncomingMessage,
1504 requestId: string,
1505 xfwd: boolean
1506 ): http.IncomingHttpHeaders {
1507 const ip = this.getRequestIp(req);
1508 const { host } = req.headers;
1509 const headers: http.IncomingHttpHeaders = {
1510 connection: 'close',
1511 'x-real-ip': ip,
1512 'x-vercel-deployment-url': host,
1513 'x-vercel-forwarded-for': ip,
1514 'x-vercel-id': requestId,
1515 };
1516 if (xfwd) {
1517 headers['x-forwarded-host'] = host;
1518 headers['x-forwarded-proto'] = 'http';
1519 headers['x-forwarded-for'] = ip;
1520 }
1521 return headers;
1522 }
1523
1524 private getServiceRouteTable(serviceName: string): Route[] {
1525 if (!this.serviceRoutesTable) {

Callers 2

delegateToServiceMethod · 0.95
DevServerClass · 0.95

Calls 1

getRequestIpMethod · 0.95

Tested by

no test coverage detected