Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

02-app > 01-building-your-application > 01-routing > 11-middleware.mdx #369

Merged
merged 6 commits into from
Jul 21, 2023

Conversation

kangju2000
Copy link
Contributor

기여자용

문서 개선

Progress

@haileyport
Copy link
Contributor

ref #46


```js filename="middleware.js"
export const config = {
matcher: '/about/:path*',
}
```

You can match a single path or multiple paths with an array syntax:
배열 문법을 사용하여 단일 경로 또는 여러 경로를 일치시킬 수 있습니다:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

문장 끝의 쌍점은 마침표로 번역해주시는게 좋을 것 같습니다. 참고

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


1. For incoming requests, `cookies` comes with the following methods: `get`, `getAll`, `set`, and `delete` cookies. You can check for the existence of a cookie with `has` or remove all cookies with `clear`.
2. For outgoing responses, `cookies` have the following methods `get`, `getAll`, `set`, and `delete`.
1. 들어오는 요청의 경우 `cookies`에는 `get`, `getAll`, `set`, `delete` 쿠키 메서드가 제공됩니다. has`로 쿠키의 존재 여부를 확인하거나 `clear`로 모든 쿠키를 제거할 수 있습니다.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{has`로 쿠키의 존재 여부를 확인하거나} 에서 백틱 하나가 빠진 것 같아요!

Suggested change
1. 들어오는 요청의 경우 `cookies`에는 `get`, `getAll`, `set`, `delete` 쿠키 메서드가 제공됩니다. has`로 쿠키의 존재 여부를 확인하거나 `clear`로 모든 쿠키를 제거할 수 있습니다.
1. 들어오는 요청의 경우 `cookies`에는 `get`, `getAll`, `set`, `delete` 쿠키 메서드가 제공됩니다. `has`로 쿠키의 존재 여부를 확인하거나 `clear`로 모든 쿠키를 제거할 수 있습니다.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

headers: requestHeaders,
},
})

// Set a new response header `x-hello-from-middleware2`
// 새 응답 헤더 `x-hello-from-middleware2` 설정
response.headers.set('x-hello-from-middleware2', 'hello')
return response
}
```

> **Good to know**: Avoid setting large headers as it might cause [431 Request Header Fields Too Large](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/431) error depending on your backend web server configuration.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이부분을 지우시는걸 깜박하신 것 같습니다:)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -268,6 +271,12 @@ In `v13.1` of Next.js two additional flags were introduced for middleware, `skip

`skipTrailingSlashRedirect` allows disabling Next.js default redirects for adding or removing trailing slashes allowing custom handling inside middleware which can allow maintaining the trailing slash for some paths but not others allowing easier incremental migrations.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

268 ~ 272 줄도 지우시는걸 깜박하신 것 같습니다:)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -268,6 +271,12 @@ In `v13.1` of Next.js two additional flags were introduced for middleware, `skip

`skipTrailingSlashRedirect` allows disabling Next.js default redirects for adding or removing trailing slashes allowing custom handling inside middleware which can allow maintaining the trailing slash for some paths but not others allowing easier incremental migrations.

## 고급 미들웨어 플래그

skipTrailingSlashRedirect`를 사용하면 후행 슬래시를 추가하거나 제거하기 위한 Next.js 기본 리디렉션을 비활성화하여 미들웨어 내부에서 사용자 정의 처리를 통해 일부 경로에는 후행 슬래시를 유지하지만 다른 경로에는 유지하지 않을 수 있어 증분 마이그레이션이 더 쉬워질 수 있습니다.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

본문과 내용이 다른 것 같은데 확인 부탁드리겠습니다

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sunmerrr
Copy link
Contributor

@kangju2000 수고하셨습니다! 리뷰 확인 부탁드려요:)

Copy link
Contributor

@yoo-jimin127 yoo-jimin127 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!
긴 내용 번역하시느라 수고 많으셨습니다 :) 👍
추가로 할당하고자 하는 티켓이 있으실 경우 이슈에 작성해주셔도 됩니다!!

@yoo-jimin127 yoo-jimin127 merged commit 1b983f8 into Nextjs-kr:main Jul 21, 2023
@yoo-jimin127 yoo-jimin127 mentioned this pull request Jul 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants