요청 URL의 호스트 이름과 경로를 사용하여 IAP(Identity-Aware Proxy) 리소스를 보호할 수 있습니다.
예를 들어 URL 경로가 /admin으로 시작하는 경우에만 request.path.startsWith IAM 조건을 사용하여 권한이 지정된 액세스 그룹의 직원에게 액세스 권한을 부여할 수 있습니다.
URL에는 호스트 이름과 경로가 있습니다. 예를 들어 URL https://sheets.google.com/create?query=param의 호스트 이름은 sheets.google.com이고 경로는 /create입니다.
백엔드는 호스트 이름과 경로를 다양한 방식으로 해석할 수 있습니다.
모호성을 없애기 위해 IAP는 정책을 확인할 때 호스트 이름과 경로 문자열을 정규화합니다.
요청에 비정규화된 경로가 있는 경우 IAP는 두 가지 정책 검사를 수행합니다. 비정규화된 경로가 정책 검사를 통과하면 IAP는 경로를 정규화하고 두 번째 정책 검사가 수행됩니다. 비정규화된 경로와 정규화된 경로가 모두 정책 검사를 통과하면 액세스 권한이 부여됩니다.
예를 들어 요청에 /internal;some_param/admin 경로가 있으면 IAP는 먼저 정규화되지 않은 경로(/internal)에서 정책 검사를 수행합니다. 해당 검사에 통과하면 IAP는 정규화된 경로(/internal/admin)에서 두 번째 정책 검사를 수행합니다.
호스트 이름
호스트 이름 정규화에는 다음이 포함됩니다.
마침표 제거
소문자로 바꾸기
ASCII로 변환
ASCII가 아닌 문자를 포함하는 호스트 이름은 Punycode를 통해 추가로 정규화됩니다. 일치 항목을 만들려면 Punycode를 사용하여 호스트 이름 문자열을 정규화해야 합니다.
호스트 이름 문자열을 Punycode로 정규화하려면 Punycoder와 같은 변환기를 사용하세요.
다음은 정규화된 호스트 이름의 예시입니다.
FOO.com은 foo.com으로 정규화되었습니다.
café.fr은 xn--caf-dma.fr로 정규화되었습니다.
경로
경로 정규화에는 다음이 포함됩니다.
경로 매개변수 삭제
절대 경로에 대한 상대 경로 결정
경로 매개변수에는 ;에서 다음 / 또는 경로 끝까지의 모든 문자가 포함됩니다.
..;으로 시작하는 경로 섹션이 포함된 요청은 유효하지 않은 것으로 간주됩니다. 예를 들어, /..;bar/ 및 /bar/..;/는 HTTP 400: Bad
Request 오류를 반환합니다.
request.host.endsWith("google.com")로 설정된 정책은 sub_domain.google.com 및 testgoogle.com과 모두 일치합니다. google.com으로 끝나는 하위 도메인에만 정책을 제한하는 경우 정책을 request.host.endsWith(".google.com")로 설정합니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-09-09(UTC)"],[],[],null,["# Using hostname and path conditions\n\n| **Important:** Limiting access based on URL hostname and path can only be done with the gcloud CLI.\n\nThis page describes hostname and path [Identity and Access Management (IAM)\nconditions](/iam/docs/conditions-overview).\n\nYou can secure Identity-Aware Proxy (IAP) resources using the\nhostname and path of a request URL.\nFor example, the `request.path.startsWith` IAM condition can be\nused to only grant access to employees in the **Privileged Access** group if\nthe URL path starts with `/admin`.\n\nFor more information about using hostname and path conditions, see\n[request attributes](/iam/docs/conditions-overview#request_attributes).\n\n### String normalization\n\nA URL has a hostname and path. For example, the URL\n`https://sheets.google.com/create?query=param`\nhas a hostname of `sheets.google.com` and a path of `/create`.\n\nBackends can interpret hostnames and paths in different ways.\nTo remove ambiguity, IAP normalizes hostname and path\nstrings when checking policies.\n\nIAP performs two policy\nchecks when a request has a non-normalized path. If the non-normalized\npath passes the policy check, IAP normalizes the path and a\nsecond policy check is performed. Access is granted if both the non-normalized\nand normalized paths pass the policy check.\n\nFor example, if a request has the path `/internal;some_param/admin`,\nIAP first performs a policy\ncheck on the non-normalized path (`/internal`). If that check passes,\nIAP performs a second policy check on the normalized path\n(`/internal/admin`).\n\n#### Hostnames\n\nHostname normalization involves the following:\n\n- Removing trailing dots\n- Lowercasing characters\n- Converting to ASCII\n\nHostnames that include non-ASCII characters are further normalized using\nPunycode. You need to use Punycode to normalize your hostname string for a match\nto be made.\n\nTo normalize your hostname string with Punycode, use a converter\nlike [Punycoder](https://www.punycoder.com/).\n\nThe following are examples of normalized hostnames:\n\n- `FOO.com` is normalized to `foo.com`\n- `café.fr` is normalized to `xn--caf-dma.fr`\n\n#### Paths\n\nPath normalization involves the following:\n\n- Removing path params\n- Resolving relative paths to their absolute equivalent\n\nA path param includes all\ncharacters from a `;` to either the next `/` or the end of the path.\n\nRequests that contain path sections starting with `..;` are considered\ninvalid. For example, `/..;bar/` and `/bar/..;/` return the `HTTP 400: Bad\nRequest` error.\n\nThe following are examples of normalized paths:\n\n- `/internal;some_param/admin` is normalized to `/internal/admin`\n- `/a/../b` is normalized to `/b`\n- `/bar;param1/baz;baz;param2` is normalized to `/bar/baz`\n\n### Subdomain endings\n\nA policy set with `request.host.endsWith(\"google.com\")` matches to both\n`sub_domain.google.com` and `testgoogle.com`. If your goal is to limit your\npolicy to only subdomains that end with `google.com`, set your policy to\n`request.host.endsWith(\".google.com\")`."]]