Uploaded image for project: 'CouchDB'
  1. CouchDB
  2. COUCHDB-855

New host manager

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Blocker
    • Resolution: Fixed
    • 1.1, 1.2
    • 1.1, 1.2
    • None
    • None
    • Regular Contributors Level (Easy to Medium)

    Description

      New vhost manager. allows dynamic add of vhosts without restart, wildcard in vhost and specific functions in erlang by kind of domain. It also fix issue in etap test (160) .

      Find attached to this ticket the patch. It is also available in my github repo :
      http://github.com/benoitc/couchdb/commit/435c756cc6e687886cc7055302963f422cf0e161

      more details :

      This gen_server keep state of vhosts added to the ini and try to
      match the Host header (or forwarded) against rules built against
      vhost list.

      Declaration of vhosts take place in the configuration file :

      [vhosts]
      example.com = /example
      *.example.com = /example

      The first line will rewrite the rquest to display the content of the
      example database. This rule works only if the Host header is
      'example.com' and won't work for CNAMEs. Second rule on the other hand
      match all CNAMES to example db. So www.example.com or db.example.com
      will work.

      The wildcard ('*') should always be the last in the cnames:

      "*.db.example.com = /" will match all cname on top of db
      examples to the root of the machine. (for now no rewriting is
      possible).

      By default vhosts redirection is handle by the function
      couch_httpd_vhost:redirect_to_vhost, but you could pass per vhost a
      specific function :

      "*.domain.com" =

      {Module, Func}

      "

      The function take the Mochiweb Request object and should return a new
      Mochiweb Request object.

      You could also change the default function to handle request by
      changing the setting `redirect_vhost_handler` in `httpd` section of
      the Ini:

      [httpd]
      redirect_vhost_handler =

      {Module, Fun}

      The function take 2 args : the mochiweb request object and the target
      path.

      Attachments

        1. COUCHDB-855-2.patch
          7 kB
          Benoit Chesneau
        2. COUCHDB-855-1.patch
          6 kB
          Benoit Chesneau
        3. COUCHDB-855_20110224-2.patch
          9 kB
          Benoit Chesneau
        4. COUCHDB-855_20110224-1.patch
          9 kB
          Benoit Chesneau
        5. COUCHDB-855_20110224-1.patch
          9 kB
          Benoit Chesneau
        6. 0001-Squashed-commit-of-the-following.patch
          22 kB
          Benoit Chesneau
        7. 0001-fix-COUCHDB-855-.-now-the-gen_server-is-only-used-to.patch
          9 kB
          Benoit Chesneau
        8. 0001-fix-COUCHDB-855-.-now-the-gen_server-is-only-used-to.patch
          9 kB
          Benoit Chesneau
        9. 0001-fix-COUCHDB-855-.-now-the-gen_server-is-only-used-to.patch
          9 kB
          Benoit Chesneau

        Activity

          People

            benoitc Benoit Chesneau
            benoitc Benoit Chesneau
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: