1

I'm creating an API in Python using FastAPI and trying to map a custom service to a path on my domain, the case is as follows:

Default Service: defaultapp.uc.r.appspot.com mapped to api.mydomain.com and working fine.

Second Service service2-dot-defaultapp.uc.r.appspot.com, I want to map it to api.mydomain.com/service2/


Default service dispatch.yaml

dispatch:
  - url: "*/service2/*"
    service: service2
  - url: "defaultapp.uc.r.appspot.com/service2/*"
    service: service2
  - url: "api.mydomain.com/service2/*"
    service: service2

service2 service2.yaml

runtime: python37
entrypoint: gunicorn -w 8 -k uvicorn.workers.UvicornWorker service2:app
service: service2

When trying to access service2 from service2-dot-defaultapp.uc.r.appspot.com it works fine,

but when I try to access it from defaultapp.uc.r.appspot.com/service2/ or api.mydomain.com/service2/ it gives me {"detail":"Not Found"},

I believe it tries to access /service2/ as a FastAPI path (example: @app.get('/service2/') from the default service, and not from dispatch.yaml,


EDIT: I've changed the default service from an API to a static site so any path given like /service2/ won't be taken from the API but from the routes in the dispath.yaml file, but still the same issue when accessing defaultapp.uc.r.appspot.com/service2/ or api.mydomain.com/service2/ it gives me {"detail":"Not Found"}

any idea how can I make it work?

Mezo
  • 163
  • 1
  • 20

0 Answers0