Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
560 views
in Technique[技术] by (71.8m points)

gcloud - GCP App Engine dispatch.yaml for dotnet core webapi and angular ui

I have default service with URL as "https://myprojectid.uc.r.appspot.com" and then I have .net core webapi deployed with service named as "mywebapi-poc" and accessible using "https://mywebapi-poc-dot-myprojectid.uc.r.appspot.com"

now I want to create route using dispatch.yaml something like this. "https://myprojectid.uc.r.appspot.com/mywebapi-poc" and "https://myprojectid.uc.r.appspot.com/mywebui-poc" which can route all web api requests to mywebapi-poc service and all web ui requests to mywebui-poc service

How can I make it work ?

dispatch:
  - url: "myprojectid.uc.r.appspot.com/"
    service: default

  - url: "myprojectid.uc.r.appspot.com/mywebapi-poc/*"
    service: mywebapi-poc
  
  - url: "myprojectid.uc.r.appspot.com/mywebui-poc/*"
    service: mywebui-poc

After doing this when I call it like this https://myprojectid.uc.r.appspot.com/mywebapi-poc/api/v1/WeatherForecast

I get 404

Similar is the case for angular web UI. First index.html page loads but after that subsequent angular app file doesn't load. For example https://myprojectid.uc.r.appspot.com/mywebui-poc/ loads index.html with 200 response but https://myprojectid.uc.r.appspot.com/mywebui-poc/main.js doesn't load and I get 404. Please note that I had path issue earlier with "/" so I replaced it in index.html with "/mywebui-poc/"

With "/" I can make individual UI service working with https://mywebui-poc-dot-myprojectid.uc.r.appspot.com

question from:https://stackoverflow.com/questions/65944776/gcp-app-engine-dispatch-yaml-for-dotnet-core-webapi-and-angular-ui

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...