heroku/heroku-buildpack-php — pull request #16 by brandon-rhodes (2012-07-10 15:56:25+00:00)
Title: Add --enable-proxy to Apache config

It is often not reasonable to assign a separate hostname to each of several apps that make up a web site. If, for example, my mailing list sign-up page happens to be implemented with a different programming language than the rest of my site, current Heroku practice would have me create a separate hostname like “list.example.com” to hold that one page — thus exposing an internal implementation detail (why should users care whether that page is written in the same language as the rest of my site?) in the URL's domain component. And the approach does not scale well: every time a small piece of functionality on my site grows large enough that I want to split it out into its own full-fledged app, I have to allocate a new hostname and create redirects for all of the old URLs that existed underneath my main “www” hostname.

This pull request is intended to do only one simple thing (but it cleans up lots of old broken URLs and version numbers along the way): it adds “--enable-proxy” to the Apache ./configure options for the PHP buildpack.

This allows the PHP buildpack to be used not only to host PHP apps and to serve static content with Apache (per Kenneth Reitz), but to accept “RewriteRule … [P]” statements in its “.htaccess” files that efficiently reverse-proxy certain URLs back to applications (like the hypothetical mailing-list sign-up page mentioned above) written in other languages and that need to be deployed to Heroku with other buildpacks as separate Heroku applications.

If you accept this pull request, you might think about providing an internal Amazon IP address by which apps could contact each other without having to route out to the public IP addresses that are the normal entrance point for your network fabric — that way, app A on Heroku, that is reverse-proxying app B for a few of its URLs, could do so WITHOUT creating “external” Amazon EC2 traffic. Instead, the traffic could be taught to loop back to one or more of those 10.*.*.* internal IP address that Amazon uses internally for EC2 instances.

If you accept this pull request, remember to rewrite the URLs in “bin/compile” once you have rebuilt Apache, so that it pulls from your “php-lp” bucket instead of from my “rhodesmill” S3 bucket!