1

This is a basic sense check question as i'm deploying a few new modules:

dispatch.yaml:

application: my-app
# No version required; this does routing independent of version.

dispatch:
  # Default module serves the typical web resources and all static resources.
  - url: "*/favicon.ico"
    module: default

  # Default module serves simple hostname request.
  - url: "simple-sample.appspot.com/"
    module: default

  # Send all mobile traffic to the mobile frontend.
  - url: "*/mobile/*"
    module: mobile-frontend

  # Send all work to the one static backend.
  - url: "*/work/*"
    module: static-backend

Wouldn't it be safer to put "*.com/mobile/*" instead of "*/mobile/*" ? In case other modules could use /mobile/ in their urls somewhere and accidentally get routed to mobile-frontend?

What if I have domain names other than .com e.g. .io?

Dan Cornilescu
  • 39,470
  • 12
  • 57
  • 97
Rusty Rob
  • 16,489
  • 8
  • 100
  • 116

1 Answers1

2

Yes, it could be considered safer in the way you're looking at it.

For the additional .io (or other) domains you can add a rule for each of those suffixes:

- url: "*.com/mobile/*"
  module: mobile-frontend
- url: "*.io/mobile/*"
  module: mobile-frontend

Side note: you don't actually need to specify the rules for the default module - all requests not matching any rules in the dispatch files are by default routed to the default module, making such rules redundant. You can test this by making a request not matching any of your dispatch.yaml rules and watching the default module's logs.

Dan Cornilescu
  • 39,470
  • 12
  • 57
  • 97
  • Thanks I'll do as you say, seems the right approach. (one for each domain). Yeah I figured any non matches would go to the default, was a fun test to make sure my entire site didn't go down :) – Rusty Rob Jul 05 '16 at 03:58
  • Keep in mind there's a limitation on the number of entries in the dispatch.yaml (afaik, it's 10) – marcadian Jul 05 '16 at 06:29
  • yup it's 10... and this puts me at 8... :) – Rusty Rob Jul 17 '16 at 01:22
  • also, i don't have SSL for some custom domains, but some modules are https (secure:always), which caused the site to not be reached in some cases. – Rusty Rob Jul 17 '16 at 01:38