Stay organized with collections
Save and categorize content based on your preferences.
To improve overall security, IAP by default denies access to
requests that do not have a matching Server Name Indication (SNI).
IAP also checks the SNI of the load balancer certificate. This allows
IAP to restrict URL redirect to malicious domains. The
IAP allowed domains feature provides an additional security
layer for your IAP-protected resources. As a resource owner
or IAP administrator, you can restrict access to
IAP-protected resources to specific domains by configuring
the allowed domains feature.
You can also configure IAP allowed domains in the following scenarios:
Your browser or an intermediate proxy is forcing connection pooling: In this scenario, you receive HTTP response 429 and error code 51. To resolve the issue, an IAP admin can update the list of allowed domains to include your host name.
The host name provided does not match the SSL certificate on the server: In this scenario, you receive error code 52. To resolve the issue, an IAP admin can update the list of allowed domains to include your host name.
Configure allowed domains
You can use gcloud or the API to configure allowed domains settings. To configure allowed domains, use the following fields:
enable: Boolean. Turns the allowed domains feature on or off.
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.
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.
gcloud iap settings get --organization=ORGANIZATION --folder=FOLDER --project=PROJECT --resource-type=RESOURCE_TYPE --service=SERVICE --version=VERSION
Replace RESOURCE_NAME in the following command with the name from the previous step. The IapSettings will be updated.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-28 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."]]