Search code examples
google-app-engineurl-routinggoogle-app-engine-python

Google App Engine routing with dispatch.yaml


I try to deploy a web app on my sandbox GCP project where there is already an app deployed. So I'm trying to play with the path to have the two web apps deployed at the same time.

My dispatch looks like this

dispatch:

- url: "*/wc/api/.*"
  service: wc-api

- url: "*/wc/.*"
  service: wc-front


- url: "*/.*"
  service: default

When I do so, all my calls to mysandbox.appspot.com/wc/ gets redirected to my default service and I don't understand why (I can see the calls in the logs of the default service).

If this helps, here is the app.yaml of my wc-front service.

runtime: python27
api_version: 1
threadsafe: yes
service: wc-front

default_expiration: "10m"

handlers:
- url: /wc/.*
  script: app.APP
  login: required
  secure: always

Do you see any error in this ?

(Calling directly wc-front-dot-mysandbox.appspot.com/wc/ returns the typical App Engine 404 error)

Thanks


Solution

  • It appears the problem was coming from the .* notation. This should only be used for the very general */.* rule.

    My new - working - dispatch

    dispatch:
    
    - url: "*/wc/api/*"
      service: wc-api
    
    - url: "*/wc/*"
      service: wc-front
    
    
    - url: "*/.*"
      service: default