Subdomains, Components and other such fun

Martin Atkins mart at degeneration.co.uk
Wed Nov 15 20:19:53 UTC 2006


I really should have looked at this months ago, but a couple of people 
were having trouble getting their external components working, reporting 
that whenever they tried to add them various things seemed to stop working.

As it turns out, this is an accidental side-effect of how subdomains are 
implemented.

By default, DJabberd does only local (intra-vhost) delivery. If you just 
have an empty VHost with no delivery plugins defined, local delivery is 
what you get. However, as soon as you declare any delivery plugins the 
local delivery plugin is no longer implicitly added.

As I noted previously, subdomains are just a shorthand for vhosts with 
inter-vhost delivery.

<VHost example.com>
     <Subdomain test>
         # ...
     </Subdomain>
     # ...
</VHost>

is roughly equivalent to:

<VHost example.com>
     <Plugin DJabberd::Delivery::LocalVHosts>
         AllowVHost test.example.com
     </Plugin>
     # ...
</VHost>

<VHost test.example.com>
     <Plugin DJabberd::Delivery::LocalVHosts>
         AllowVHost example.com
     </Plugin>
     # ...
</VHost>

Since there is now a delivery plugin defined, you must explicitly 
declare the local delivery plugin, like this:

<VHost example.com>
     <Plugin DJabberd::Delivery::Local />
     <Subdomain test>
         # ...
     </Subdomain>
     # ...
</VHost>

If you do the above, everything should work happily. Without that 
explicit local delivery, the packets get from example.com users to the 
subdomain and back, but then example.com doesn't know how to deliver the 
packets to the right user so it looks from the outside like nothing is 
working.

I just tested this on the latest trunk using pyMSNt both in a subdomain 
and a separate vhost with manual configuration. If there is any more 
quirky behavior please let me know and I'll investigate some more!

My external component config looks like this:

<Subdomain msn>
   <Plugin DJabberd::Component::External>
     ListenPort 15642
     Secret password
   </Plugin>
</Subdomain>

---------

This behavior with subdomains is of course non-obvious, but we can't 
just assume that a domain with subdomains will have local delivery. I'm 
not really sure what the right fix is here. If we make a subdomain still 
imply local delivery, we need a way to explicitly disable local delivery.



More information about the Djabberd mailing list