Ability to disable 293453: Wildcard DNS - default domain
| Project: | Domain Access |
| Version: | 5.x-1.11 |
| Component: | Code |
| Category: | task |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
293453: Wildcard DNS - default domain introduced a rather ugly case: not being able to access one's test/devel domain.
We use OTAP, meaning different domains for development, testing, Acceoptance and Production. While on production the redirect introduced in #293453 may be good (arguable), for dev and test it certainly is not.
Issue #1: I was developing and chagning some settings in devel. but. without notice I was redirected to the LIVE site. So instead of disabling some module on test, I actually did that on live! My fault, I should havve taken notice of the addressbar, but being unaware of this feature, I did not know. Minor issue with a large impact.
Issue #2: No longer being able to change any settings on the devel site. I had to manually comment the drupal_goto in the source of domain module in order to disable the module alltogether on development urls.
issue #3: All urls, inclduding other-example.com/foo/bar lead to example.com. instead of example.com/foo/bar. Users who land on the wrong domain are always erdirected to the Homepage, not to the path they gave.
I would like to discuss a way to disable this feature alltogether. In all our cases we want, nor need this feature.
But I expect a toggel for this option to be a) a usability issue and b) a performace issue.
Thoughts?

#1
Domain Alias fixes this problem but removing this behavior entirely and allowing redirects on a per-alias basis, but is currently for D6 and needs to be backported. (With domain_alias, you simply say "yes, redirect *.example.com to example.com unless it matches another registered domain.)
Making this a setting is fine by me -- though we have lots of settings already.
Line 57ff of domain.module would become something like so:
// If return is -1, then the DNS didn't match anything, so use defaults.if ($_domain == -1) {
$_domain = domain_default();
// If the request was not for the primary domain, send the user there. See http://drupal.org/node/293453 and http://drupal.org/node/321071.
if (variable_get('domain_redirect_wildcards', FALSE) && !empty($_domain['subdomain']) && $_subdomain != $_domain['subdomain']) {
That patch should work for you right now.
#2
Would
<?php$options = array('-1' => t('Do not change domain'));
?>
Somehow it does not show up on my main site. Which makes me think that there is something else going wrong there.
I would expect t('Do not change domain') to be the setting that disabled automatic redirects.
If so, then I best change above code into
<?php// If return is -1, then the DNS didn't match anything, so use defaults.
if ($_domain == -1) {
$_domain = domain_default();
// If the request was not for the primary domain, send the user there. See <a href="http://drupal.org/node/293453" title="http://drupal.org/node/293453" rel="nofollow">http://drupal.org/node/293453</a> and <a href="http://drupal.org/node/321071.
" title="http://drupal.org/node/321071.
" rel="nofollow">http://drupal.org/node/321071.
</a> if ((variable_get('domain_default_source', 0) != -1) && !empty($_domain['subdomain']) && $_subdomain != $_domain['subdomain']) {
?>
#3
And abovementioned change in a patch.
#4
Possibly. I am deep in development on the D6 version, so this is not really getting my attention.
I don't think that is what 'default_domain_source' is designed for, so using it in that way may confuse people. That's why I think a separate setting is in order.
#5
This patch contains the requested separate setting.
#6
.. nope. this patch...
#7
I will test this for D5, since I may need it now.
#8
I have split this patch into two parts. One part controls the redirect setting. The other controls the display of the message indicating that a redirect has taken place.
Be default, both are set to TRUE, which is the current behavior.
#9
Automatically closed -- issue fixed for 2 weeks with no activity.