Notice: Over the next few months, we're reorganizing the App Engine documentation site to make it easier to find content and better align with the rest of Google Cloud products. The same content will be available, but the navigation will now match the rest of the Cloud products. If you have feedback or questions as you navigate the site, click Send Feedback.

Issuing HTTP(S) Requests

Stay organized with collections Save and categorize content based on your preferences.

Region ID

The REGION_ID is an abbreviated code that Google assigns based on the region you select when you create your app. The code does not correspond to a country or province, even though some region IDs may appear similar to commonly used country and province codes. For apps created after February 2020, REGION_ID.r is included in App Engine URLs. For existing apps created before this date, the region ID is optional in the URL.

Learn more about region IDs.

This page describes how to issue HTTP(S) requests from your App Engine app.

For details on request size limits and which headers are sent in a URL Fetch request, see Outbound Requests.

Issuing an HTTP request

To issue an outbound HTTP request, use the http package as usual, but create your client using urlfetch.Client. urlfetch.Client returns an *http.Client that uses urlfetch.Transport, which is an implementation of the http.RoundTripper interface that makes requests using the URL Fetch API.

The following snippet demonstrates how to perform a basic HTTP GET request:

import (


func handler(w http.ResponseWriter, r *http.Request) {
	ctx := appengine.NewContext(r)
	client := urlfetch.Client(ctx)
	resp, err := client.Get("")
	if err != nil {
		http.Error(w, err.Error(), http.StatusInternalServerError)
	fmt.Fprintf(w, "HTTP GET returned status %v", resp.Status)

Issuing an HTTPS request

In the Go API, you do not need to explicitly secure your request. The underlying URL Fetch service validates the certificate of the host it is contacting by default, and rejects requests if the certificate does not match.

Disabling host certificate validation

To disable automatic host certificate validation, you can manually create a Transport and set AllowInvalidServerCertificate to true.

Issuing a request to another App Engine app

When issuing a request to another App Engine app, your App Engine app must assert its identity by adding the header X-Appengine-Inbound-Appid to the request.

What's next

Learn about the URL Fetch service, such as the headers that are sent in a URL Fetch request in Outbound Requests.