MCPcopy Create free account
hub / github.com/Kilo-Org/cloud / baseProxy

Function baseProxy

apps/web/src/proxy.ts:13–40  ·  view source on GitHub ↗
(request: NextRequestWithAuth)

Source from the content-addressed store, hash-verified

11
12function baseProxy(request: NextRequestWithAuth) {
13 const requestHeaders = new Headers(request.headers);
14 requestHeaders.set('x-pathname', request.nextUrl.pathname);
15 requestHeaders.set('x-http-method', request.method);
16 // The query, kept separate from the pathname: `appendCallbackPath` re-attaches
17 // it to the sign-in callback so a resume link does not lose its `?at=` anchor
18 // (and the browser does not lose any other query) across the sign-in detour.
19 requestHeaders.set('x-search', request.nextUrl.search);
20
21 const response = NextResponse.next({
22 request: {
23 headers: requestHeaders,
24 },
25 });
26
27 if (request.nextUrl.pathname === '/auth/verify-magic-link') {
28 response.headers.set('Cache-Control', 'no-store');
29 response.headers.set('X-Robots-Tag', 'noindex, noarchive, nofollow');
30 }
31
32 const cspHeaderName = getContentSecurityPolicyHeaderName(getContentSecurityPolicyMode());
33 if (cspHeaderName) {
34 response.headers.set(
35 cspHeaderName,
36 buildContentSecurityPolicy({
37 isDevelopment: process.env.NODE_ENV === 'development',
38 connectSrcUrls: getConfiguredConnectSrcOrigins(),
39 })
40 );
41 }
42
43 return response;

Callers

nothing calls this directly

Calls 5

setMethod · 0.65

Tested by

no test coverage detected