Search code examples
erlangyaws

YAWS: Update docroot while YAWS is running


I'm working with an implementation of YAWS and would like to have an easy way for developers to switch between using the docroot specified in yaws.conf and a custom location which contains a development build.

Eg. say docroot is set to serve /TEST/html

I want a developer to be able to switch docroot to /TEST/dev/html while YAWS is still running (and only have that change effect that one user).

Any suggestions on how I could accomplish this would be appreciated.


Solution

  • There are a few ways to accomplish this:

    1. Set up a separate server instance in your yaws.conf file with a different docroot.
    2. Run an entirely separate Yaws instance for testing purposes.
    3. Use an appmod registered on "/" to examine all incoming requests and redirect those specific to your developers to a different directory area.
    4. Use arg rewriting to redirect developer requests to a different server instance (follow that link to section 7 of the Yaws PDF documentation).

    Of these, I'd recommend 1 or 2, since 3 and 4 rely on "special" URLs that might cause problems if used by a non-developer (in general, mixing testing and production on the same server endpoint can be problematic).