Koozali.org: home of the SME Server

Remote web hosting. Issue with sites using no www prefix

Remote web hosting. Issue with sites using no www prefix
« 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

Re: Remote web hosting. Issue with sites using no www prefix
« Reply #1 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

guest22

Re: Remote web hosting. Issue with sites using no www prefix
« Reply #2 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


Offline ReetP

  • *
  • 3,731
  • +5/-0
Re: Remote web hosting. Issue with sites using no www prefix
« Reply #3 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
...
1. Read the Manual
2. Read the Wiki
3. Don't ask for support on Unsupported versions of software
4. I have a job, wife, and kids and do this in my spare time. If you want something fixed, please help.

Bugs are easier than you think: http://wiki.contribs.org/Bugzilla_Help

If you love SME and don't want to lose it, join in: http://wiki.contribs.org/Koozali_Foundation