John Jerrby
John Jerrby

Reputation: 1703

Context routing for two different apps

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/

Upvotes: 1

Views: 2751

Answers (2)

Anatoly Kern
Anatoly Kern

Reputation: 631

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

Upvotes: 1

data_henrik
data_henrik

Reputation: 17156

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.

Upvotes: 4

Related Questions