Location

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

Location 응답 헤더는 리다이렉트 할 페이지의 URL을 나타냅니다. 이 헤더는 3xx (redirection) 또는 201 (created) 응답 상태와 함께 제공됩니다.

리다이렉션의 경우, Location이 가리키는 페이지를 가져오기 위해 새 요청을 만드는데 사용하는 HTTP 메서드는 원본 메서드와 리다이렉션의 종류에 따라 달라집니다.

  • 303 (See Other) 응답 코드는 항상 GET 메서드를 사용합니다.
  • 307 (Temporary Redirect), 308 (Permanent Redirect)은 원본 요청에서 사용한 메서드를 변경하지 않습니다.
  • 301 (Moved Permanently), 302 (Found)는 대부분 메서드를 변경하지 않지만, 오래된 사용자 에이전트는 변경할 수도 있습니다.

위의 상태 코드 중 하나가 포함된 모든 응답은 Location 헤더를 보냅니다.

리소스 생성의 경우, 새로 만들어진 리소스의 URL을 나타냅니다.

LocationContent-Location는 서로 다릅니다. Location은 리다이렉션의 대상이나 새로 만들어진 리소스의 URL을 나타냅니다. Content-Location는 추가적인 콘텐츠 협상이 없는 콘텐츠 협상이 발생했을 때, 리소스에 접근하는데 사용할 다이렉트 URL을 나타냅니다. Location은 응답과 관련된 헤더지만, Content-Location은 반환된 엔티티와 연관되어 있습니다.

헤더 타입 응답 헤더
금지된 헤더 이름 아니요

구문

http
Location: <url>

지시어

<url>

요청 URL의 상대 경로 또는 절대 경로

예제

http
Location: /index.html

기술 사양

Specification
HTTP Semantics
# field.location

브라우저 호환성

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Location

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

같이 보기