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.
dispatch.xml allows you to override routing
You can use the
dispatch.xml 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.xml 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.
Deploying the dispatch fileThe
dispatch.xmlfile should reside in the
WEB-INFdirectory of the default service. To deploy the dispatch file by itself, use the
appcfg update_dispatchcommand, and specify the directory for the default service. Be sure that all the services mentioned in the file have already been deployed before using the following command:
Deploy without altering the currently serving version, replacing
with the path to your application main directory:
appcfg.sh update_dispatch <application directory>
cdto the application directory containing the default service, then run the command:
appcfg.sh update_dispatch .
You can also deploy the dispatch file at the same time you deploy one or more
services, by adding the optional
auto_update_dispatch flag, which can be used
in two forms:
appcfg.sh --auto_update_dispatch update <app-directory>|<files...> appcfg.sh -D update <app-directory>|<files...>
For more information about the deployment commands, see Deploying a Java 8 App.
SyntaxThe root element in the
<dispatch-entries>and each entry is a
<dispatch>element that contain the following elements.
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.
Specifies the name of the service that will handle the requests that
Tip: You can include glob patterns like the
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.
URL paths that begin with
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 <module>. All
static content is served from the
default <module>. 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
<?xml version="1.0" encoding="UTF-8"?> <dispatch-entries> <dispatch> <!-- Default module serves the typical web resources and all static resources. --> <url>*/favicon.ico</url> <module>default</module> </dispatch> <dispatch> <!-- Default module serves simple hostname request. --> <url>simple-sample.uc.r.appspot.com/</url> <module>default</module> </dispatch> <dispatch> <!-- Send all mobile traffic to the mobile frontend. --> <url>*/mobile/*</url> <module>mobile-frontend</module> </dispatch> <dispatch> <!-- Send all work to the one static backend. --> <url>*/work/*</url> <module>static-backend</module> </dispatch> </dispatch-entries>
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 rules
To delete all dispatch rules:
Edit the contents of the
<?xml version="1.0" encoding="UTF-8"?> <dispatch-entries/>
dispatch.xmlfile to App Engine.