On Aug 16, 2011, at 3:07 PM, vapirix wrote:

> So I'm attempting to set up the usage scenario of:
> 
> domain1.com -> load app 1
> domain2.com -> load app 2
> etc. etc.
> 
> I need domain1 to NOT have access to app 2, 3, 4, 5, etc.
> 
> That all works using the router's "domain" settings. Obviously you run
> into the problem of: domain1.com loads app1, but domain1.com/app2
> loading app2, so I use "exclusive_domain = True", and then I have to
> do domain1.com/app1/ to load the app without raising an exception,
> which seems counter productive. Besides that, even with
> exclusive_domain = True, I can do domain1.com/app2 to load the second
> app. Is there any way to do what I'm attempting to do here? I'd rather
> not have to set up separate web2py installs for the tons of tiny apps
> I do for my clients that get 1 hit every 6 months.
> 
> What can I do here, friends?

I'm looking at this logic a little more closely, and it seems to me that the 
current code is wrong in a way that doesn't have to do with enforcing 
exclusive_domain. It's easy to fix, but I wonder if someone is relying on the 
wrong behavior.

The problem is this. Suppose you enable domain routing thus:

        domains = {
                "domain1.com" : "app1",
                "www.domain1.com" : "app1",
                "domain2.com" : "app2",
        }

Right now, domain2.com/app1 will load app1 because the code recognizes app1 as 
an app, and that takes priority over the domain. But that's a bug. It *should* 
load app2 because the domain specifies it. And in that case, "app1" in the URL 
will be most likely interpreted as a *function*, as it should, I believe.

That is, the domain should take priority in app determination if the domain is 
in the domain map, meaning that we don't really care whether "app1" happens to 
be the name of an app in another domain. So (unlike what I said the other day), 
this does not immediately result in an exception. It probably *will* result in 
an invalid-function exception, but that's just normal processing.

And that's why exclusive_domain is only a check on output. In fact, I'm 
wondering if it should be the default (or not there at all, but rather always 
true).

Reply via email to