cloud-foundryswisscomdev

where to point CNAME entry for cloudfoundry routes distinguished by path?


We run multiple applications in Cloudfoundry. Now we have the requirement to distinguish app requests by path - this is clearly possible by using

cf create-route myspace mydomain.com –hostname myapp –path foo
cf map-route my-app mydomain.com –hostname myapp –path foo
cf create-route myspace mydomain.com –hostname myapp –path bar
cf map-route my-another-app mydomain.com –hostname myapp –path bar

now the requests are routed like this:

but to make this all work, I also need a DNS entry to resolve myapp.mydomain.com, to where do I point the CNAME record e.g. on cloudflare for myapp.mydomain.com?

my-app.scapp.io or my-another-app.scapp.io do not look correct, because its not one or the other I want to address, but both.


Solution

  • Typically you'd make a CNAME record that points to the default route assigned to your app. It looks like my-app.scapp.io in your example above, but you can run cf app <name> and find the assigned route.

    Because you're using path-based routing, you'd only need one CNAME record for both apps. It would then be up to the client to select the correct path such that they are routed to the right application.