I'm looking at various pages about dispatch.yaml, most of which contain similar information and examples:
https://cloud.google.com/appengine/docs/flexible/nodejs/how-requests-are-routed#routing_with_a_dispatch_file https://cloud.google.com/appengine/docs/python/config/dispatchref https://cloud.google.com/appengine/docs/go/config/dispatchref etc.
I happen to be using node.js on GAE Flexible Environment, but I think it would be the same for every language and environment.
The problem is that these pages don't really specify how dispatch.yaml works. In particular:
- Are rules applied in the order given? I'm assuming that the first matching rule is the one used, but nothing seems to say so.
- Do leading glob (wildcard) characters match only the domain name, or could they match the first part of the URL's path? If the rule is
*/hello
, would that matchmyapp.appspot.com/path/hello
? I'm guessing not, based on some vague hints in the docs, but it isn't very clear. - If no rule in dispatch.yaml matches the URL, will it be routed to the default service? I would think it would have to, but again, these pages don't say.
- Do URLs get rewritten based on the rules before they're sent to the service? If the rule is
*/path/*
and the URL ishttps://myapp.appspot.com/path/hello
, will the service see it as/path/hello
or as/hello
? I'm guessing the former.
I'm doing some trial and error now, so I may be able to answer my own question soon. I'm also submitting this to Google through their documentation feedback system.
glcoud app deploy --project my-project
) will deploy app.yaml, cron.yaml, queue.yaml and index.yaml if found in the project root, but will not deploy dispatch.yaml. Without deploying dispatch.yaml, all requests will continue to go to thedefault
Service. – Cossack