两个不同应用程序的上下文路由
Context routing for two different apps
我将两个不同的应用程序部署到 CF,我希望能够为这两个应用程序使用上下文路径路由
例如
假设我部署了两个应用程序,并且我能够使用以下 URL.
1. app1.domain.com
2. app2.domain.com
现在我想以某种方式使用CF的上下文路径路由
能够像下面这样使用这个应用程序
1. something.domain.com/app1
2. something.domain.com/app2
我的问题是:
- I missing the "something", what should I put in the apps manifest to be able to use it like above ?
- How should I define the routes in the mainfest.yml file?
- what should I put in the path?
例子会很有帮助
幸运的是我最近准备了一个blog post and a tutorial on context path routing。这是教程中的示例 manifest.yml
,其中显示了同一域中具有不同路由的两个应用程序:
# 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 才能部署它。有关详细信息和其他链接,请参阅 tutorial。
您还可以在下面的地图路线文档中找到一个很好的示例
https://docs.cloudfoundry.org/devguide/deploy-apps/routes-domains.html#map-route
我将两个不同的应用程序部署到 CF,我希望能够为这两个应用程序使用上下文路径路由 例如
假设我部署了两个应用程序,并且我能够使用以下 URL.
1. app1.domain.com
2. app2.domain.com
现在我想以某种方式使用CF的上下文路径路由 能够像下面这样使用这个应用程序
1. something.domain.com/app1
2. something.domain.com/app2
我的问题是:
- I missing the "something", what should I put in the apps manifest to be able to use it like above ?
- How should I define the routes in the mainfest.yml file?
- what should I put in the path?
例子会很有帮助
幸运的是我最近准备了一个blog post and a tutorial on context path routing。这是教程中的示例 manifest.yml
,其中显示了同一域中具有不同路由的两个应用程序:
# 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 才能部署它。有关详细信息和其他链接,请参阅 tutorial。
您还可以在下面的地图路线文档中找到一个很好的示例
https://docs.cloudfoundry.org/devguide/deploy-apps/routes-domains.html#map-route