dispatch.yaml allows you to override the routing
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
example, if you wanted to route requests to the
http://simple-sample.appspot.com/mobile/ URL to a mobile front end, and serve
all your static content from the default service.
dispatch.yamlfile should reside in the
rootdirectory or in the directory that defines the default service.
Deploying the dispatch configuration fileTo deploy the dispatch configuration file, run the following command:
gcloud app deploy dispatch.yaml
If you install the original App Engine SDK, you can run:
appcfg.py update_dispatch [YOUR_APP_DIR]
Deleting all dispatch rules
To delete all dispatch rules:
Edit the contents of the
dispatch.yamlfile to App Engine.
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.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
SyntaxThe root element in the
<dispatch-entries>and each entry is a
<dispatch>element that contain the following elements. .
Specifies the name of the service that will handle the requests that
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 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.