两个不同应用的上下文路由 [英] Context routing for two different apps

查看:68
本文介绍了两个不同应用的上下文路由的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将两个不同的应用部署到CF,并且希望能够为这两个应用使用上下文路径路由例如

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.

让我说我已经部署了两个应用程序,并且可以使用以下URL来使用它.

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

现在我想以某种方式使用CF的上下文路径路由就能像以下

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

我的问题是:

  1. 我错过了东西",我应该在应用清单中放些什么以便能够像上面一样使用它?
  2. 如何在mainfest.yml文件中定义路由?
  3. 我应该在路径中输入什么?

示例将非常有帮助

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

推荐答案

很幸运,我最近准备了教程在上下文路径路由上.这是从教程中提取的示例 manifest.yml ,该示例显示了在同一域上具有不同路由的两个应用程序:

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/

您甚至可以在一个清单文件中为单个应用程序定义多个路由. routes 属性是路由信息的位置.请注意, path 指向应用程序的源代码(如果采用这种方式),并且您需要使用最新版本的 cf CLI进行部署.有关更多信息和其他链接,请参见教程.

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.

这篇关于两个不同应用的上下文路由的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆