revel/revel — pull request #573 by tpjg (2014-04-08 05:09:44+00:00)
Title: Add AppRoot to allow changing the root path of an application

This PR introduces a new config variable app.root that can be used to change the root location of the Revel application. This can be used to run multiple different applications on a single server:port combination. Typically more then one application is/can be run on a server and a frontend server (e.g. nginx) is used to proxy the requests. This PR makes it easy to deploy the application in such an environment without any URL rewriting necessary on the Web server, just defining app.root=/app1 should be enough.

Of course the application developer must be disciplined and use the routes and {{url}} helpers throughout the application. Any hardcoded paths must be prevented, for example when loading JavaScript (case in point is the testrunner Index.html view). As an extra the template helper {{url `Root`}} is created to prefix the application root to hardcoded (JavaScript) paths.

(retarget of PR #572)