[Mailman-Users] Another twist on Error: Unknown virtual host

Mark Sapiro msapiro at value.net
Wed Sep 5 01:31:58 CEST 2007


runner at winning.com wrote:

>
>> VIRTUAL_HOSTS = { 'lists.mydomain.org': 'lists.mydomain.org' }
>> 
>> This is a little different than the examples in the FAQs because 
>> the domain names for the URLs and the email should be the same in 
>> our case, we don't want to remove the "lists" part.  Can someone 
>> tell me if this is the proper way to resolve our "Unknown virtual 
>> host" problem?
>
>This worked... in cases like mine you have to be sure not to use the add_virtualhost command but instead edit the mm_cfg.py file by hand.


Yes, it worked, but it is wrong.

Since you already have (per your OP)

DEFAULT_URL_HOST = 'lists.mydomain.org'
DEFAULT_EMAIL_HOST = 'lists.mydomain.org'

in mm_cfg.py, the proper way to do this is to add following those two
lines

VIRTUAL_HOSTS.clear()
add_virtualhost(DEFAULT_URL_HOST, DEFAULT_EMAIL_HOST)

or if you prefer

VIRTUAL_HOSTS.clear()
add_virtualhost('lists.mydomain.org', 'lists.mydomain.org')

The VIRTUAL_HOSTS.clear() line is not really required, and it actually
dilutes what I'm going to say next, but it may be desirable to remove
the results of the add_virtualhost(DEFAULT_URL_HOST,
DEFAULT_EMAIL_HOST)
from Defaults.py.

The reason the above is better than your

VIRTUAL_HOSTS = { 'lists.mydomain.org': 'lists.mydomain.org' }

or the equivalent

VIRTUAL_HOSTS = { DEFAULT_URL_HOST: DEFAULT_EMAIL_HOST }

is it will still work when we change the implementation of the
VIRTUAL_HOSTS dictionary.


Also note, add_virtualhost only removes the leftmost subdomain from the
url host for the email host if it is not given a second argument for
the email host.

-- 
Mark Sapiro <msapiro at value.net>       The highway is for gamblers,
San Francisco Bay Area, California    better use your sense - B. Dylan



More information about the Mailman-Users mailing list