This page explains how to use URL lists to create and manage granular access policies for your outbound web traffic within your Secure Web Proxy instance. Instead of creating individual rules for every website, URL lists let you define a reusable, centralized collection of domains, hostnames, and specific URL patterns.
Here are a few key benefits of using URL lists:
Simplify policy management: you can apply a large set of
allowordenyrules with a single reference in your security policy.Enforce precise control: you can use specific syntax to match entire domains, subdomains, or exact URL paths. This helps ensure that your workloads can access only authorized destinations.
Secure web access: you can efficiently secure and audit web access across your Google Cloud environment.
Before you begin
Complete the initial setup steps.
Verify that you have the Google Cloud CLI version 406.0.0 or later installed:
gcloud version | head -n1If you have an earlier gcloud CLI version installed, update the version:
gcloud components update --version=406.0.0
Create a Secure Web Proxy instance with an empty policy
To create a Secure Web Proxy instance, you must first create an empty security policy and then create a web proxy that uses the policy.
Create an empty security policy
Console
In the Google Cloud console, go to the SWP Policies page.
Click Create a policy.
In the Name field, enter a name for the policy, such as
myswppolicy.In the Description field, enter a description for the policy, such as
My new swp policy.For Regions, select the region where you want to create the policy, such as
us-central1.Click Create.
Cloud Shell
Use a text editor to create a
policy.yamlfile.Add the following code to the
policy.yamlfile:name: projects/PROJECT_NAME/locations/REGION/gatewaySecurityPolicies/POLICY_NAME description: POLICY_DESCRIPTIONReplace the following:
PROJECT_NAME: name of your projectREGION: region where your policy is created, such asus-central1POLICY_NAME: name of your policyPOLICY_DESCRIPTION: description for your policy
Import the security policy by using the
gcloud network-security gateway-security-policies importcommand:gcloud network-security gateway-security-policies import POLICY_NAME \ --source=POLICY_FILE.yaml \ --location=REGION
Create a web proxy
Console
In the Google Cloud console, go to the Web Proxies page.
Click Create a secure web proxy.
In the Name field, enter a name for the web proxy, such as
myswp.In the Description field, enter a description for the web proxy, such as
My new swp.For Routing mode, select one of the following options:
- Explicit: deploys your Secure Web Proxy instance in explicit proxy mode.
- Next hop: deploys your Secure Web Proxy instance in next hop mode.
For Regions, select the region where you want to create the web proxy, such as
us-central1.For Network, select the network where you want to create the web proxy.
For Subnetwork, select the VPC subnet that you created during the initial setup.
Optional: In the Web proxy IP address field, enter the Secure Web Proxy IP address.
You can enter an IP address from the range of Secure Web Proxy IP addresses that reside in the subnetwork you created in the previous step. If you don't enter the IP address, then your Secure Web Proxy instance automatically chooses an IP address from the selected subnetwork.
For Certificate, select the certificate that you want to use to create the web proxy.
For Policy, select the policy that you created to associate the web proxy with.
Click Create.
Cloud Shell
Use a text editor to create a
gateway.yamlfile.Add the following code to the
gateway.yamlfile:name: projects/PROJECT_NAME/locations/REGION/gateways/GATEWAY_NAME type: SECURE_WEB_GATEWAY ports: [GATEWAY_PORT_NUMBERS] certificateUrls: [CERTIFICATE_URLS] gatewaySecurityPolicy: projects/PROJECT_NAME/locations/REGION/gatewaySecurityPolicies/POLICY_NAME network: projects/PROJECT_NAME/global/networks/NETWORK_NAME subnetwork: projects/PROJECT_NAME/regions/REGION/subnetworks/SUBNETWORK routingMode: ROUTING_MODE addresses: [GATEWAY_IP_ADDRESS] scope: samplescopeOptional: To allow client applications from other Google Cloud regions to connect to your proxy, enable global access when creating your Secure Web Proxy instance.
In the
gateway.yamlfile, add theallow_global_accessfield and set it totrue.Important: You can enable
allow_global_accessonly when you create a Secure Web Proxy instance. You can't configure this setting later.name: projects/PROJECT_NAME/locations/REGION/gateways/GATEWAY_NAME type: SECURE_WEB_GATEWAY