Is is possible to do the following using nginx rewrite:
Convert a url from CTX_URL=http://my-cloudfoundry.com/app/home to SUB_DOMAIN_URL=http://app.my-cloudfoundry.com/home
Where my-cloudfoundry is the server running Nginx, which can currently route SUB_DOMAIN_URL, I want it to accept the CTX_URL and convert it internally to SUB_DOMAIN_URL
this is perfectly possible, in fact I have it working on my local copy of CloudFoundry that uses the vcap.me domain.
You need to add one simple rewrite rule to nginx.conf (on a current vcap install this is located in ‘~/cloudfoundry/.deployments/devbox/deploy/nginx/nginx-0.8.54/conf’), below the server_name directive in the server block, insert;
Obviously you will need to change “vcap.me” to the domain you are using in your configuration.