Django subdomains unexpected behaviour
<p>My two subdomains aren't routing correctly.</p>

<p>Here is my middleware class</p>

<pre><code>MIDDLEWARE_CLASSES = [
    'subdomains.middleware.SubdomainURLRoutingMiddleware',
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
</code></pre>

<p>As you can see SubdomainURL Routing middleware is above Common.</p>

<p>The configuration is like so:</p>

<pre><code>ROOT_URLCONF = 'deltaforce.urls'

SUBDOMAIN_URLCONFS = {
    'api': 'errorPage.urls',
    None: 'interface.urls',
}
</code></pre>

<p>The issue is both abc.com and api.abc.com are routing to the None/<code>interface.urls</code>. </p>

<p>I came to know about the same from the 404 page on each. The difference between <code>deltaforce.urls</code> and <code>interface.urls</code> is the default admin console which is not showing up which is a good sign that it is not using <code>ROOT_URLCONF</code> but the <code>api</code> is also showing similar behavior as the only page in error page is 404 which i am using to test it out. It's 404 page is showing a list of urls from interface. </p>

<p>Here is something else that might be important:</p>

<pre><code>ALLOWED_HOSTS = [".abc.com"]
</code></pre>

<p><code>abc.com</code> and other subdomains are there is a <code>/etc/hosts</code> file and finally this is all behind an nginx proxy which passes host headers properly based on requested url on 404 page.</p>