Context routing for two different apps

夙愿已清 提交于 2019-12-22 00:27:05

问题


I deploy two different apps to CF and I want to be able to use the context path routing for those two apps e.g.

lets say I've two apps that deployed and I was able to consume it with the following URL.

1. app1.domain.com
2. app2.domain.com

Now I want somehow to use the context path routing of CF to be able to use this apps like following

1. something.domain.com/app1

2. something.domain.com/app2

My question are:

  1. I missing the "something", what should I put in the apps manifest to be able to use it like above ?
  2. How should I define the routes in the mainfest.yml file?
  3. what should I put in the path?

Example will be very helpful

https://www.cloudfoundry.org/context-path-routing/


回答1:


Lucky that I recently prepared a blog post and a tutorial on context path routing. Here is a sample manifest.yml taken from the tutorial that shows two apps with different routes on the same domain:

# This manifest deploys two applications.
#
# Both use the same host and domain name as defined
# by their respective route(s) property. The first app
# uses the root path, the second the "sub" and
# "lower" paths.

applications:
# The Python app starts here
- name: yourname-myapp
  memory: 256M
  command: python myapp.py
  routes:
  - route: yourname-myapp.mybluemix.net
  path: ./top/
# The Node.js app starts here  
- name: yourname-myapp-node
  routes:
  - route: yourname-myapp.mybluemix.net/lower
  - route: yourname-myapp.mybluemix.net/sub
  path: ./lower/

You can even define multiple routes for a single app, all in a single manifest file. The routes property is the place for the routing information. Note that the path points to the source code for the app (if done this way) and that you need a recent version of cf CLI to deploy it. See the tutorial for more information and additional links.




回答2:


You can also find a good example in the map route documentation per below

https://docs.cloudfoundry.org/devguide/deploy-apps/routes-domains.html#map-route



来源:https://stackoverflow.com/questions/42629961/context-routing-for-two-different-apps

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!