Target Proxies

Target proxies are referenced by one or more global forwarding rules and route the incoming HTTP or HTTPS requests to a URL map. You can manage target proxies by using either the gcloud command-line tool or the REST API methods.

Target proxy properties

See the TargetHttpProxies or TargetHttpsProxies resource for descriptions of the properties and methods available to you when working with target proxies through either the REST API or the gcloud command-line tool.

Add a target proxy

To add a target proxy using the gcloud command-line tool, use one of the following command:

HTTP

gcloud compute target-http-proxies create [HTTP_PROXY] \
  --url-map URL_MAP [--description [DESCRIPTION]]

HTTPS

gcloud compute target-https-proxies create [HTTPS_PROXY] \
  --url-map URL_MAP --ssl-certificate [SSL_CERTIFICATES] \
  [--description [DESCRIPTION]]

HTTPS load balancing does not support using multiple SslCertificate resources with a single proxy. Your sslCertificates array must specify exactly one SslCertificate resource.

To create a target proxy through the API, send a POST request to:

HTTP

POST https://www.googleapis.com/v1/compute/projects/PROJECT_ID/global/targetHttpProxies

{
  "name": [PROXY_NAME],
  "urlMap": [URL_MAP]
}

HTTPS

POST https://www.googleapis.com/v1/compute/projects/[PROJECT_ID]/global/targetHttpsProxies

{
  "name": [PROXY_NAME],
  "urlMap": [URL_MAP],
  "sslCertificates": [ [SSL_CERTIFICATE] ]
}

HTTPS load balancing does not support using multiple SslCertificate resources with a single proxy. Your sslCertificates array must specify exactly one SslCertificate resource.

List target proxies

To list target proxies using the gcloud command-line tool, use the following command:

HTTP

gcloud compute target-http-proxies list

HTTPS

gcloud compute target-https-proxies list

In the API, send an empty GET request to the following URI:

HTTP

https://www.googleapis.com/compute/v1/projects/[PROJECT_ID]/global/targetHttpProxies

HTTPS

https://www.googleapis.com/compute/v1/projects/[PROJECT_ID]/global/targetHttpsProxies

Get a target proxy

To get information about a single target proxy using the gcloud command-line tool, use the following command:

HTTP

gcloud compute target-http-proxies describe [PROXY_NAME]

HTTPS

gcloud compute target-https-proxies describe [PROXY_NAME]

In the API, send an empty GET request to the following URI:

HTTP

https://www.googleapis.com/compute/v1/projects/PROJECT_ID/global/targetHttpProxies/[PROXY_NAME]

HTTPS

https://www.googleapis.com/compute/v1/projects/PROJECT_ID/global/targetHttpsProxies/[PROXY_NAME]

Delete a target proxy

To delete a target proxy, you must first delete any global forwarding rules that reference it.

To delete a target proxy using the gcloud command-line tool, use the following command:

HTTP

gcloud compute target-http-proxies delete [PROXY_NAME]

HTTPS

gcloud compute target-https-proxies delete [PROXY_NAME]

In the API, send an empty DELETE request to the following URI:

HTTP

https://www.googleapis.com/compute/v1/projects/[PROJECT_ID]/global/targetHttpProxies/[PROXY_NAME]

HTTPS

https://www.googleapis.com/compute/v1/projects/[PROJECT_ID]/global/targetHttpsProxies/[PROXY_NAME]

Update a URL map for the target proxy

To update the URL map associated with a target proxy with the gcloud command-line tool, use the following command:

HTTP

gcloud compute target-http-proxies update [PROXY_NAME] \
   --url-map [URL_MAP]

HTTPS

gcloud compute target-https-proxies update [PROXY_NAME] \
   --url-map [URL_MAP]

In the API, send a POST request to the following URI, passing the fully-qualified URI to the URL maps to add or remove in the request body:

HTTP

POST https://www.googleapis.com/compute/v1/projects/[PROJECT_ID]/global/targetHttpProxies/[PROXY_NAME]/setUrlMap

{
  "urlMap": [URL_MAP]
}

HTTPS

POST https://www.googleapis.com/compute/v1/projects/[PROJECT_ID]/global/targetHttpsProxies/[PROXY_NAME]/setUrlMap

{
  "urlMap": [URL_MAP]
}

Update the SSL certificate resource for an HTTPS target proxy

Because HTTP proxies do not use SSL certificates, these instructions only apply to HTTPS proxies.

To update the SSL certificate resource associated with an HTTPS target proxy using the gcloud command-line tool, use the following command:

HTTPS

gcloud compute target-https-proxies update [PROXY_NAME] \
   --ssl-certificate [SSL_CERTIFICATE]

In the API, send a POST request to the following URI, passing the fully-qualified URI of the SSL certificate resource to add or remove in the request body:

HTTPS

POST https://www.googleapis.com/compute/v1/projects/[PROJECT_ID]/global/targetHttpsProxies/[PROXY_NAME]/setSslCertificates

{
  "sslCertificates": [
    [SSL_CERTIFICATE]
  ]
}

Monitor your resources on the go

Get the Google Cloud Console app to help you manage your projects.

Send feedback about...

Compute Engine Documentation