I am trying to use CloudBees PaaS (RUN@CloudBees) to consolidate essentially three different distinct uses under the same URL space:
- root (/) main landing, marketing page
- app (/app) java app running in CloudBees
- blog (/blog) another java app running in cloudbees or possibly outside (example.wordpress.com)
If I was doing it myself in a datacenter or in AWS I would setup a reverse proxy (possibly like Varnish and configure reverse proxy to map the URL space as follows:
- root (/): www.example.com/ --> CMS running as cloudbees app example-cms.cloudbees.net
- app (/app) java app running in CloudBees www.example.com/app -> app.example.com
- blog (/blog) similarly www.example.com/blog -> example.wordpress.com or exampleblog.cloudbees.net
How can I achieve the same with CloudBees. Can it be done? Is this too much to expect from a PaaS vendor?
An interesting problem, and a few solutions:
- Use domains instead of paths (eg blog.example.com etc) - so you can use DNS to direct things
- Build an app that essentially proxies traffic for you (this could run on cloudbees or elsewhere) - there are lots of ways to do this.
- Use some routing/proxy service (like CloudFlare) which may let you set up routing rules (so it can proxy traffic).
My preference would always be for number 1 - DNS is a great way to do things like this.
You can with this approach have /blog similar Urls in your paas application, and have it do a 302 redirect to the real blog.example.com - that kind of gives you a bit of both.