Skip to content

Commit

Permalink
Feature: server component url 접근을 위한 middleware 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
6mn12j committed Mar 28, 2024
1 parent 5d3a761 commit 4487210
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/middleware.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// /middleware.ts
import { NextResponse } from 'next/server';

export function middleware(request: Request) {
// Store current request url in a custom header, which you can read later
const requestHeaders = new Headers(request.headers);
requestHeaders.set('x-url', request.url);

return NextResponse.next({
request: {
// Apply new request headers
headers: requestHeaders,
},
});
}

0 comments on commit 4487210

Please sign in to comment.