Compute Services

Context path routes for your Bluemix Cloud Foundry apps

Share this post:

Recently, I have experimented with combining several runtimes and apps. You can read about my experiences in the blog “Manifest files: Understand Domain and Host Property for Your Bluemix Cloud Foundry Apps“. The reason behind my experiments were to put together a sample for Context Path Routing for use with IBM Bluemix Cloud Foundry apps. But what are context path routes and what does the sample do? Here are the details.

Cloud Foundry introduced Context Path Routing last year. Until then, there was the requirement that each app (or service) was served from its own hostname. Now, apps can share a host with each app being served from a specific path on that host. Here are three examples:

Two Apps, Three Routes - Context Path Routes

One Domain, Two Apps, Three Routes – Sample App using Context Path Routes

  1. When building a larger website, there could be several so-called microsites embedded. With Context Path Routing it is possible to serve, e.g., from one web app and or from other apps. All these apps could be written in different programming languages such as Node.js, Python, Java and others.
  2. For a more complex microservice-based app, following the principles of the Twelve Factor App, there could be several (backing) services involved. The app and each would require their own hostname. With Context Path Routing the app could use and services could be served from,, etc.
  3. It is possible to encrypt custom domains on Bluemix with the “Let’s Encrypt” Certificate Authority and related tools. It is based on the same principles as example one. Read here about how to use Context Path Routes and “Let’s Encrypt” to secure your custom domain.

Getting Started with Context Path Routes

So how could you use the new routing feature? There are several Cloud Foundry CLI commands related to routing. They allow to specify an additional path for application routes. Manifest files also have optional route properties that could be set. To get started, take a look at my Context Path Routing sample on GitHub for details. It has two small apps written in Python and Node.js that share a host using specific paths. The apps can be deployed with a single command and allow to experiment with context paths. The “What this samples does” section gives you some ideas.

Technical Offering Manager / Developer Advocate

More Compute Services stories
April 29, 2019

Transforming Customer Experiences with AI Services (Part 1)

This is an experience from a recent customer engagement on transcribing customer conversations using IBM Watson AI services.

Continue reading

April 26, 2019

Updated Tutorial: Database-Driven Chatbot

The tutorial on how to build a database-driven chatbot has been updated. It's now simpler to deploy and and offers more options—Slack, Facebook Messenger, Wordpress, and more.

Continue reading

April 24, 2019

How To Use IBM Cloud Object Storage with Veeam

As you may have heard, Veeam 9.5u4 now includes an integration with IBM Cloud Object Storage. This integration can result in up to 10x savings on long-term data retention and an overall reduction in IT and primary storage costs.

Continue reading