MyBB Community Forums

Full Version: Forum emits bad URLs if directions are'nt followed.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have a board (offline) that can be accessed by different domains depending on where from. The directions in the Board Settings -> General Configuration -> Board URL say to include the "http://" part, but if I do and enter an internal name the page sends an absolute reference to the style sheet as http://internal.domain/..., it fails to resolve when accessed externally. I get a similar problem with using the external domain name, the page can not be accessed when the internet is down except directly by IP, but still sends the external domain in the page for style sheets which fails to resolve.

I have noticed that I can just enter '/forums' instead of 'http://some.domain/forums' and this works fine for now, but wonder if it will break anything as a result or in any future versions since it says to include 'http://'. There are a few other options I've noticed if it does cause any problems.

1. On the other internal hosts I could add the external domain name to the hosts file as the internal IP address, so it will resolve even if the internet is down. (Though this may nor work well if public DNS servers and various network clients take advantage of the SRV DNS records)

2. I can directly edit settings.php and set the bburl setting to "http://".$_SERVER['HTTP_HOST']."/forums' as well, so it will send the page based on the HTTP Host header.
Domain names are supposed to be accessible from anyone on the web, and their DNS's should point to an accessible IP as well. If this isn't how it works, then you've created a setup that is very unusual. Don't expect it to be supported
(2010-01-01, 03:18 AM)Ryan Gordon Wrote: [ -> ]Domain names are supposed to be accessible from anyone on the web, and their DNS's should point to an accessible IP as well. If this isn't how it works, then you've created a setup that is very unusual. Don't expect it to be supported

I have ~8 computers behind a router/IP sharing device. The computers can be accessed directly as their computer name internally. (Windows has this name resolution built in, Linux can use nmbd and libnss_winbind) The IP sharing device has port forwarding to forward HTTP to the server, but the Internet sometimes has downtime problems with my provider, so I can't really use 'http://<externalip>/forums' from the inside when it is down, though I would still like to access it internally even when it is down.

When accessed internally, I just access it as 'http://<computername>/forums', with 'computername' being the internal 'domain' name but when accessed externally from away from home, I just access it as 'http://<externalip>/forums' with the IP address being the external 'domain' name. If I only accessed it externally from my own computer I could configure it just to use the internal name, and edit /etc/hosts to map the computer name to the external IP address when away from home, but I access it from a library or friend's computer away from home.

It doesn't seem like it would be a problem to just use '/forums' instead of the full 'http://computername/forums/' as the Board URL setting, as when sending a page with an embedded url, '<link rel="stylesheet" href="/forums/path/to/stylesheet.css" />' will provide the same thing as '<link rel="stylesheet" href="http://computername/forums/path/to/stylesheet.css" />', but will work for both 'http://computername/forums' internally and 'http://externalip/forums/' when accessed away from home. But if need be I found I can make it use the same host the user enters in a browser simply by the edit of settings.php to use "http://".$_SERVER['HTTP_HOST']."/forums", it just gets cleared every time I edit board settings and save them and I have to manually edit it again.

I would think It shouldn't be a problem to have the forums be accessed by two different domain names. Actually I can think of some situations where it may be the case, such as domain name migration, where a new domain name may be used but the old domain name still in effect for a while, both may point to the same server address.
With a local DNS or hosts file entry you can use the domain.tld name to access it even without Internet access. It's a matter of your local network configuration.

There's also a plugin that claims to be able to handle multiple domains, based on the http host, you could try that... but a proper local network setup would be the better, more powerful solution.
To access internally just set the hosts file on your computer to go directly to the computer IP so it will resolve even if the internet is down.

That should work and it's a better method than what you're doing now.

Quote: If I only accessed it externally from my own computer I could configure it just to use the internal name, and edit /etc/hosts to map the computer name to the external IP address when away from home, but I access it from a library or friend's computer away from home.

In that case if the provider has a problem you won't get access anyways. Basically you're creating a problem where it shouldn't be. Websites are meant to be on the internet. If your internet is down you can't expect anyone to fix that.

Quote:Forum emits bad URLs if directions are'nt followed.

That's offensive in a couple ways. For one it's implying something is wrong with MyBB. For another it's obvious that if you don't follow directions something might not work. That's the point of directions to begin with. If you want this odd configuration you certainly can't expect MyBB to give the instructions or offer support.