Skip to content

Commit

Permalink
Merge pull request #253 from modern-agile-team/modify/modifying_subdo…
Browse files Browse the repository at this point in the history
…main_redir/#252

서브도메인 리다이렉트 수정
  • Loading branch information
zzzRYT authored Mar 21, 2024
2 parents 7ed1cab + 1865ebb commit b62c66b
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 18 deletions.
29 changes: 12 additions & 17 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,19 @@ const nextConfig = {
// ];
// },
//강제 리다이렉트 실행
async middleware() {
return ['./src/middleware'];
},
rewrites() {
return {
beforeFiles: [
{
source: '/:path*',
has: [
{
type: 'host',
value: 'www.menbosha.kr',
},
],
destination: 'https://menbosha.kr/:path*',
},
],
};
return [
{
source: '/:path*',
has: [
{
type: 'host',
value: 'www.menbosha.kr',
},
],
destination: '//:path*',
},
];
},
generateEtags: false,
images: {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"dev": "env-cmd -f .env.development next dev",
"dev:mock": "env-cmd -f .env.mock next dev",
"build": "next build",
"start": "next start",
Expand Down
13 changes: 13 additions & 0 deletions src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,16 @@ export function middleware(req: IncomingMessage, res: ServerResponse) {
}
}
}

export const config = {
matcher: [
/*
* 아래와 같이 시작하는 것들을 제외한 모두 경로를 매치합니다:
* - api (API routes)
* - _next/static (static files)
* - _next/image (image optimization files)
* - favicon.ico (favicon file)
*/
'/((?!api|_next/static|_next/image|favicon.ico).*)',
],
};

0 comments on commit b62c66b

Please sign in to comment.