Skip to content

Commit

Permalink
chore: ROOT_DOMAIN 환경변수 제거
Browse files Browse the repository at this point in the history
  • Loading branch information
WooWan committed Aug 6, 2024
1 parent e3b17bd commit dd25c3b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 0 additions & 2 deletions .env.template
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,3 @@ NAVER_REDIRECT_URI=
KAKAO_MAP_BASE_URL=
KAKAO_MAP_API_KEY=
DAUMCDN_POSTOCDE_URL=

ROOT_DOMAIN=
6 changes: 3 additions & 3 deletions src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ export const config = {

export function middleware(request: NextRequest) {
const url = request.nextUrl;
const hostname = request.headers
.get("host")!
.replace(".localhost:3000", `.${process.env.ROOT_DOMAIN}`);
const hostname = request.headers.get("host")!;
const searchParams = request.nextUrl.searchParams.toString();

const path = `${url.pathname}${
searchParams.length > 0 ? `?${searchParams}` : ""
}`;

const subDomain = hostname.split(".")[0];
console.log("subDomain", subDomain, "hostname", hostname);

switch (true) {
case subDomain !== hostname:
return NextResponse.rewrite(
Expand Down

0 comments on commit dd25c3b

Please sign in to comment.