Ressourcenzugriff auf bestimmte Domains beschränken
Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Um die allgemeine Sicherheit zu verbessern, lehnt IAP standardmäßig den Zugriff auf Anfragen ab, die keine übereinstimmende Server Name Indication (SNI) haben.
IAP prüft auch das SNI des Load Balancer-Zertifikats. So kann IAP die URL-Weiterleitung auf schädliche Domains beschränken. Die Funktion „Zugelassene IAP-Domains“ bietet eine zusätzliche Sicherheitsebene für Ihre mit IAP geschützten Ressourcen. Als Ressourceninhaber oder IAP-Administrator können Sie den Zugriff auf IAP-geschützte Ressourcen auf bestimmte Domains beschränken, indem Sie die Funktion „Zulässige Domains“ konfigurieren.
Sie können auch in den folgenden Fällen zulässige IAP-Domains konfigurieren:
Ihr Browser oder ein Zwischenproxy erzwingt das Verbindungs-Pooling:In diesem Fall erhalten Sie die HTTP-Antwort 429 und den Fehlercode 51. Um das Problem zu beheben, kann ein IAP-Administrator die Liste der zulässigen Domains aktualisieren und Ihren Hostnamen hinzufügen.
Der angegebene Hostname stimmt nicht mit dem SSL-Zertifikat auf dem Server überein:In diesem Fall wird der Fehlercode 52 angezeigt. Um das Problem zu beheben, kann ein IAP-Administrator die Liste der zulässigen Domains aktualisieren und Ihren Hostnamen hinzufügen.
Zulässige Domains konfigurieren
Sie können die Einstellungen für zulässige Domains mit gcloud oder der API konfigurieren. Verwenden Sie die folgenden Felder, um zulässige Domains zu konfigurieren:
enable: Boolesch. Aktiviert oder deaktiviert die Funktion „Zulässige Domains“.
Domains: String. Liste der zulässigen Domains. Die Domains können Platzhalterpräfixe enthalten, z. B. *.example.com.. Domainnamen dürfen keinen Platzhalter direkt vor einem öffentlichen Suffix oder einer Top-Level-Domain enthalten. Beispiel: *.com, *.co.in.
Weitere Informationen finden Sie unter IapSettings.
Rufen Sie den Ressourcennamen mit dem Befehl gcloud iap settings get ab. Kopieren Sie das Feld „Name“ aus der Ausgabe. Sie benötigen den Namen im nächsten Schritt.
gcloud iap settings get --organization=ORGANIZATION --folder=FOLDER --project=PROJECT --resource-type=RESOURCE_TYPE --service=SERVICE --version=VERSION
Ersetzen Sie im folgenden Befehl RESOURCE_NAME durch den Namen aus dem vorherigen Schritt. Die IapSettings wird aktualisiert.
Probleme beim Zugriff auf zugelassene Domains
Wenn Sie den Fehlercode 53 erhalten, bitten Sie einen IAP-Administrator, Ihren Hostnamen der Liste der zugelassenen Domains hinzuzufügen.
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-08-18 (UTC)."],[],[],null,["# Restrict resource access to specific domains\n\nTo improve overall security, IAP by default denies access to\nrequests that do not have a matching Server Name Indication (SNI).\nIAP also checks the SNI of the load balancer certificate. This allows\nIAP to restrict URL redirect to malicious domains. The\nIAP allowed domains feature provides an additional security\nlayer for your IAP-protected resources. As a resource owner\nor IAP administrator, you can restrict access to\nIAP-protected resources to specific domains by configuring\nthe allowed domains feature.\n\nYou can also configure IAP allowed domains in the following scenarios:\n\n- **Your browser or an intermediate proxy is forcing connection pooling:** In this scenario, you receive HTTP response 429 and error code [`51`](/iap/docs/faq?#error_codes). To resolve the issue, an IAP admin can update the list of allowed domains to include your host name.\n- **The host name provided does not match the SSL certificate on the server:** In this scenario, you receive error code [`52`](/iap/docs/faq?#error_codes). To resolve the issue, an IAP admin can update the list of allowed domains to include your host name.\n\nConfigure allowed domains\n-------------------------\n\nYou can use gcloud or the API to configure allowed domains settings. To configure allowed domains, use the following fields:\n\n- **`enable`**: Boolean. Turns the allowed domains feature on or off.\n- **`Domains`** : String. The list of allowed domains. The domains can contain wildcard prefixes, such as `*.example.com.` Domain names cannot contain a wildcard directly on a public suffix or on a top level domain. Example: `*.com`, `*.co.in`.\n\nFor more information, see [IapSettings](/iap/docs/reference/rest/v1/IapSettings#accesssettings).\n\nTo configure IAP allowed domains, complete the following steps: \n\n### Console\n\n1. Go to the IAP page. \n [Go to Identity-Aware Proxy](https://console.cloud.google.com/security/iap/).\n2. Select a project, and then select the resource on which you want to enable the allowed domains feature.\n3. Open **Settings** for the resource. Under **Allowed domains** , select **Enable Allowed Domains**.\n4. Specify the list of allowed domains, and then click **Save**.\n\n### gcloud\n\nFollowing are some example commands for specifying allowed domains.\n\nFor more information, see [`gcloud iap settings set`](/sdk/gcloud/reference/iap/settings/set).\n\nRun the following command: \n\n```\ngcloud iap settings set SETTING_FILE --folder=FOLDER --organization=ORGANIZATION --project=PROJECT --resource-type=RESOURCE_TYPE --service=SERVICE --version=VERSION\n```\n\nWhere `SETTING_FILE` is: \n\n accessSettings:\n allowed_domains_settings:\n enable: true\n domains: [\"*.example.com\", \"*.example.net\"]\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eFOLDER\u003c/var\u003e: The folder ID.\n- \u003cvar translate=\"no\"\u003eORGANIZATION\u003c/var\u003e: The organization ID.\n- \u003cvar translate=\"no\"\u003ePROJECT\u003c/var\u003e: The project ID.\n- \u003cvar translate=\"no\"\u003eRESOURCE_TYPE\u003c/var\u003e: The IAP resource type. Must be `app-engine`, `iap_web`, `compute`, `organization`, or `folder`.\n- \u003cvar translate=\"no\"\u003eSERVICE\u003c/var\u003e: The service name. This is optional when `resource-type` is `compute` or `app-engine`.\n- \u003cvar translate=\"no\"\u003eVERSION\u003c/var\u003e: The version name. This is not applicable for `compute`, and is optional when `resource-type` is `app-engine`.\n\n### API\n\nTo configure allowed domains, complete the following steps. For more information about using the API to configure allowed domains, see [IapSettings](/iap/docs/reference/rest/v1/IapSettings#accesssettings).\n\n1. Run the following command to prepare an `iap_settings.json` file. Update the values as needed.\n\n```\n {\n \"access_settings\":{\n \"allowed_domains_settings\":{\n \"enable\": true\n \"domains\": [\n \"*.example.com\",\n \"*.exampe.net\"\n ]\n }\n }\n }\n```\n\n1. Get the resource name by running the `gcloud iap settings get` command. Copy the name field from the output. You will need the name in the following step.\n\n```\ngcloud iap settings get --organization=ORGANIZATION --folder=FOLDER --project=PROJECT --resource-type=RESOURCE_TYPE --service=SERVICE --version=VERSION\n```\n\n1. Replace `RESOURCE_NAME` in the following command with the name from the previous step. The `IapSettings` will be updated.\n\n```\ncurl -X PATCH \\\n-H \"Authorization: Bearer $(gcloud auth print-access-token)\" \\\n-H \"Accept: application/json\" \\\n-H \"Content-Type: application/json\" \\\n-d @iap_settings.json \\\n\"https://iap.googleapis.com/v1/RESOURCE_NAME:iapSettings?updateMask=iapSettings.accessSettings.allowedDomainsSettings.enable,iapSettings.accessSettings.allowedDomainsSettings.domains\"\n```\n\nTroubleshooting\n---------------\n\n**Allowed domains access issue** \n\nIf you receive [Error code 53](/iap/docs/faq?#error_codes), ask an IAP administrator to add your host name to the list of allowed domains."]]