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. Including
REGION_ID.r in App Engine URLs is optional for
existing apps and will soon be required for all new apps.
To ensure a smooth transition, we are slowly updating App Engine to use region IDs. If we haven't updated your Google Cloud project yet, you won't see a region ID for your app. Since the ID is optional for existing apps, you don't need to update URLs or make other changes once the region ID is available for your existing apps.
Learn more about region IDs.
Security is a core feature of the Google Cloud, but there are still steps you should take to protect your App Engine app and identify vulnerabilities.
Use the following features to ensure that your App Engine app is secure. To learn more about the Google Security Model and the available steps that you can take to secure your Cloud projects, see Google Cloud Platform Security.
Use HTTPS requests to access to your App Engine app securely. Depending on how your app is configured, you have the following options:
- Use the
httpsURL prefix to send HTTPS request to the
defaultservice of your Cloud project, for example:
To target specific resources in your App Engine app, use the
-dot-syntax to separate each resource you want to target, for example:
To convert an HTTP URL to an HTTPS URL, replace the periods between each resource with
-dot-, for example:
For more information about HTTPS URLs and targeting resources, see How Requests are Routed.
- Use the
- Custom domains
To send HTTPS requests with your custom domain, you can use the managed SSL certificates that are provisioned by App Engine. For more information, see Securing Custom Domains with SSL.
- App handlers
To force HTTPS for your app's handlers, you can specify the
secure: alwayselement for each handler in your
app.yaml, for example:
handlers: - url: /.* script: auto secure: always redirect_http_response_code: 301
secure: alwaysredirects all HTTP traffic to an HTTPS URL with the same path, see the
app.yamlconfiguration reference for more information.
In each Cloud project, set up access control to determine who can access the services within the project, including App Engine. You can assign different roles to different accounts to ensure each account has only the permissions it needs to support your app. For details see, Setting Up Access Control.
App Engine firewall
The App Engine firewall enables you to control access to your App Engine app through a set of rules that can either allow or deny requests from the specified ranges of IP addresses. You are not billed for traffic or bandwidth that is blocked by the firewall. Create a firewall to:
- Allow only traffic from within a specific network
- Ensure that only a certain range of IP addresses from specific networks can access your app. For example, create rules to allow only the range of IP addresses from within your company's private network during your app's testing phase. You can then create and modify your firewall rules to control the scope of access throughout your release process, allowing only certain organizations, either within your company or externally, to access your app as it makes its way to public availability.
- Allow only traffic from a specific service
- Ensure that all the traffic to your App Engine app is first proxied through a specific service. For example, if you use a third-party Web Application Firewall (WAF) to proxy requests directed at your app, you can create firewall rules to deny all requests except those that are forwarded from your WAF.
- Block abusive IP addresses
- While Google Cloud has many mechanisms in place to prevent attacks, you can use the App Engine firewall to block traffic to your app from IP addresses that present malicious intent or shield your app from denial of service attacks and similar forms of abuse. You can add IP addresses or subnetworks to a denylist, so that requests routed from those addresses and subnetworks are denied before they reach your App Engine app.
For details about creating rules and configuring your firewall, see Controlling App Access with Firewalls.
You can use network ingress controls to restrict traffic so that your app only receives HTTP requests from specific sources:
All: (default) Your app will receive all traffic, including direct requests sent from the internet.
Internal and Cloud Load Balancing: Your app will only receive requests that are routed through Cloud Load Balancing, or that are sent from VPC networks in the same project. All other requests are denied with a
Internal-only: Your app will only receive requests that are sent from VPC networks in the same project. All other requests are denied with a
View ingress settings
Go to the App Engine Services page.
Locate the Ingress column. For each service, the value in this column shows the ingress setting as one of All (default), Internal + Load Balancing, or Internal.
To view the ingress setting for a service using the
gcloud app services describe SERVICE
Replace SERVICE with the name of your service.
For example, to view the ingress settings and other information for the default service run:
gcloud app services describe default
Edit ingress settings
Go to the App Engine Services page.
Select the service you wish to edit.
Click Edit ingress setting.
Select the ingress setting that you want from the menu and click Save.
To update the ingress setting for a service using the
gcloud app services update SERVICE --ingress=INGRESS
- SERVICE: The name of your service.
- INGRESS: The ingress control you want to apply. One of
To update the default service of an App Engine app to accept traffic only from Cloud Load Balancing and VPC networks that are in the same project:
gcloud app services update default --ingress=internal-and-cloud-load-balancing
To update a service named "internal-requests" to accept traffic only from VPC networks that are in the same project:
gcloud app services update internal-requests --ingress=internal-only
The Google Cloud Web Security Scanner discovers vulnerabilities by crawling your App Engine app, following all that links within the scope of your starting URLs, and attempting to exercise as many user inputs and event handlers as possible.
In order to use the security scanner, you must be an owner of the Cloud project. For more information on assigning roles, see Setting Up Access Control.
You can run security scans from the Google Cloud Console to identify security vulnerabilities in your App Engine app. For details about running the Security Scanner, see the Security Scanner Quickstart.