4

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

Valentin Coudert
  • 1,759
  • 3
  • 19
  • 44
  • I am facing the same issue. I want to route "*/api/*" to backend service and "*/api/model/*" to model service. I wrote the dispatch.yaml to do so even keeping the model service routing at the top but still all the load is going to backend service – Sushant Pachipulusu May 04 '21 at 07:16

2 Answers2

4

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
Valentin Coudert
  • 1,759
  • 3
  • 19
  • 44
1

Yes, indeed, you need to configure your dispatch.yaml file, for App Engine to route your application based on the URL that you set there. It seems that your service: default it's getting all URLs and redirecting them to the service set there.

Considering that, I would recommend you to take a look at the official documentation about configuring the dispatch.yaml file - you can get some better ideas on how to configure it - and this other post from the Community, where another user has a similar use case as yours, that I believe should help you.

Let me know if the information helped you!

gso_gabriel
  • 4,199
  • 1
  • 10
  • 22
  • hello, my dispatch is in my post. Anything wrong with it ? Thanks – Valentin Coudert Mar 03 '20 at 09:08
  • Hi @ValentinCoudert By checking your `dispatch.yaml` file, it seems that your logic on `- url: "*/.*" service: default` it making every call that has a `/` to go to the `default` service. Could you please give it a try removing this or changing it? – gso_gabriel Mar 03 '20 at 11:16