Koozali.org: home of the SME Server

Obsolete Releases => SME Server 8.x => Topic started by: quentin@tw.co.nz on December 10, 2014, 11:51:53 PM

Title: Remote web hosting. Issue with sites using no www prefix
Post by: quentin@tw.co.nz on December 10, 2014, 11:51:53 PM
Hi All.

We've got a client network where we redirect web-traffic to thier own website (say www.abc.nz ) with a remote host entry called 'www'
The client's new website, redirects traffic to abc.nz  This works great outside of the network, but when the request is coming from inside the client's network SME jumps in and tries to server the page.

So, the question is.

Is there any way to set a remote IP re-direct for when no host is defined at the server's primary domain?
We're familiar with custom templates etc, however still need a nudge in the right direction.

Many thanks
Quentin Pidduck
Title: Re: Remote web hosting. Issue with sites using no www prefix
Post by: quentin@tw.co.nz on December 17, 2014, 12:10:59 AM
I've found that creating the custom template
/etc/e-smith/templates-custom/var/service/tinydns/root/data/50domainARecords
 with the contents
{
    $OUT .= "# A Records for domains\n";
    foreach my $domain (get_domains())
{
if ($domain eq "abc.nz"){
        $OUT .= "+$domain:111.111.111.111\n";
} else {
        $OUT .= "+$domain:$LocalIP\n";
    }}
    $OUT .= "\n";
}



Means after expansion the tindydns data file looks more like this
(excerpt from /var/service/tinydns/root/data)
# A Records for domains
+abc.nz:111.111.111.111
+secondarydomain.nz:192.168.1.1

and testing internally this appears to work without any negative impact.

If anyone can imagine a problem with using the solution please let me know, otherwise we'll implement this for our client.

Please note the domain abc.nz and the IPs above are fictional examples only. 111.111.111.111 is representative of an eternally hosted site and 192.168.1.1 is representative of the SME server's internal IP address.

Cheers,
Quentin Pidduck
Technologywise Ltd
Tauranga NZ
Title: Re: Remote web hosting. Issue with sites using no www prefix
Post by: guest22 on December 17, 2014, 01:03:41 AM
Quentin,


nice catch. Do you feel we need to document this, and if so, how would we describe it please?


guest

Title: Re: Remote web hosting. Issue with sites using no www prefix
Post by: ReetP on December 29, 2014, 01:07:58 AM
Good one Quentin !

Hope you are well :-)

HSF, not sure where it should go - somewhere in httpd customisations I guess ? Definitely wants noting though.

B. Rgds
John