Stay organized with collections Save and categorize content based on your preferences.
Region IDThe 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.
Note: This reference uses a YAML formatted configuration file, used by tooling based on gcloud CLI, such as the gcloud CLI, or gcloud CLI-based Maven, Gradle, Eclipse, or IntelliJ plugins.The dispatch.yaml
allows you to override routing rules. You can use the dispatch.yaml
to send incoming requests to a specific service (formerly known as modules) based on the path or hostname in the URL.
For more information, see How Requests are Routed.
An app can have only one dispatch.yaml
file, and the routing rules in that file apply to all of the app's services and versions. The routing rules also apply to URLs that are used in a cron file or a task queue configuration.
The dispatch.yaml
file can reside anywhere in your source code directory.
To deploy the dispatch configuration file without otherwise altering the currently serving version, use one of the following commands in the directory containing your dispatch file, depending on your environment:
gcloudgcloud app deploy dispatch.yaml
Maven
mvn appengine:deployDispatch dispatch.yaml
Gradle
gradle appengineDeployDispatch dispatch.yaml
IDE
If you use IntelliJ or Eclipse, you select the individual configuration files to be deployed using the deployment form.
For more information about the deployment commands, see
Deploying a Java 8 App.
SyntaxThe root element in the dispatch.yaml
file is dispatch:
and contains a list of routing definitions that are specified by the following subelements.
The rules that you define in your dispatch file must use HTTP URL patterns that include the ".
" notation for separating subdomains. URLs defined with the HTTPS "-dot-
" notation are not supported.
Dispatch rules are order dependent, and only the first rule that matches a URL will be applied.
Element Descriptionservice
Specifies the name of the service that will handle the requests that match the url
pattern. Note that services were previously called modules.
url
In the url
element, you define the URL pattern, which can include the host name and URL path that are no longer than 100 characters. For the service
element, you specify the name of the service that you want handling any incoming requests that match the URL pattern of the url
element.
Tip: You can include glob patterns like the *
wildcard character in the url
element; however, those patterns can be used only before the host name and at the end of the URL path.
A URL pattern that can include the hostname and URL path. Glob characters can be used to match patterns. The Glob characters can be specified only at the beginning of the pattern and end of the pattern. Specify the URL pattern within quotes.
URL paths that begin with /_ah/
are not routed by the dispatch file.
The following is a sample dispatch file that routes requests to https://simple-sample.uc.r.appspot.com
and requests like https://simple-sample.uc.r.appspot.com/favicon.ico
to the default
service. All static content is served from the default
service. Mobile requests like https://simple-sample.uc.r.appspot.com/mobile/
are routed to a mobile frontend, and worker requests like https://simple-sample.uc.r.appspot.com/work/
are routed to a static backend.
dispatch:
# Default service serves the typical web resources and all static resources.
- url: "*/favicon.ico"
service: default
# Default service serves simple hostname request.
- url: "simple-sample.uc.r.appspot.com/"
service: default
# Send all mobile traffic to the mobile frontend.
- url: "*/mobile/*"
service: mobile-frontend
# Send all work to the one static backend.
- url: "*/work/*"
service: static-backend
If you prefer general routing rules that match many possible requests, you can define rules with wider scopes. For example:
# Send any path that begins with “simple-sample.uc.r.appspot.com/mobile” to the mobile-frontend service.
- url: "simple-sample.uc.r.appspot.com/mobile*"
service: mobile-frontend
# Send any domain/sub-domain with a path that starts with “work” to the static backend service.
- url: "*/work*"
service: static-backend
You can also write expressions that are more strict:
# Matches the path "/fun", but not "/fun2" or "/fun/other"
- url: "*/fun"
service: mobile-frontend
# Matches the hostname 'customer1.myapp.com', but not '1.customer1.myapp.com.
- url: "customer1.myapp.com/*"
service: static-backend
Limits
The dispatch file can contain up to 20 routing rules. When specifying the URL string, neither the hostname nor the path can be longer than 100 characters.
Deleting all dispatch rulesTo delete all dispatch rules:
Edit the contents of the dispatch.yaml
file to:
dispatch: []
Deploy the dispatch.yaml
file to App Engine.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-07 UTC.
[[["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-07 UTC."],[[["`REGION_ID` is a Google-assigned code based on the region selected when creating an app, not a country or province code, and it's included in App Engine URLs for apps created after February 2020."],["The `dispatch.yaml` file allows you to override routing rules to direct incoming requests to specific services based on the URL's path or hostname, with only one such file allowed per app."],["Dispatch rules within the `dispatch.yaml` file are order-dependent, with only the first matching rule being applied to a given URL, and these rules are utilized in cron and task queue configurations."],["The `dispatch.yaml` file uses HTTP URL patterns that must include the \".\" notation for subdomains, supports glob patterns, can contain a maximum of 20 routing rules, and neither the hostname nor the path can exceed 100 characters."],["You can use specific commands like `gcloud app deploy dispatch.yaml` or `mvn appengine:deployDispatch dispatch.yaml` to deploy the `dispatch.yaml` file without altering the currently serving version and you can even edit the file to `dispatch: []` to delete all rules when deployed."]]],[]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4