Why does modx-based site start using different domains for some content?

Posted by naxa on Pro Webmasters See other posts from Pro Webmasters or by naxa
Published on 2013-04-20T07:10:02Z Indexed on 2013/11/07 22:23 UTC
Read the original article Hit count: 428

Filed under:
|
|
|
|

situation

I have a modx site on a VPS with multiple domain and subdomain names. The modx site should use what I call the 'primary' domain name's 'primary' subdomain, ie www.intendedname.tld . The problem is that as time pass, the site mysteriously starts using another subdomain for links to content like videos, images, and even pages and (internal) links. The other subdomains doesn't serve this content of course. If I clear the modx cache, the original state is restored. However, the problem comes back again later.

The VPS has a domain registered and multiple A records pointing to the VPS's IP, as subdomains. There is the 'primary' whan which is intended to be used as the public content server, the other ones are like docs. and test., etc.

On top of that, I have dynamic-dns service client installed from no-ip on the machine and a dynamic domain-name bound. It gives a completely different domain name. I originally used it for ssh login and to serve a completely different site.

An nginx server is put into good use to do rewrite the different subdomains to the right places.

edit The modx templates use Templates use <base href="[[++site_url]]" />.

current attempt to fix

The current 'solution' to the problem is to also use the rewrite to rewrite everything to the 'primary' domain and subdomain. In the nginx config file for the site, it utilizes (unsurprisingly) the rewrite directive to rewrite the unexpected server_name entries (ie. the other subdomains) in a server block dedicated to this task.

So with this, the main site basically works (sort of) but this renders all the other functions (docs) useless.

Before this rewrite was set, the 'solution' was to clear the modx cache on a regular basis. The original modx content is not getting corrupted, only the files in cache are.

What can I do to find out what actual the problem is and fix it?

© Pro Webmasters or respective owner

Related posts about domains

Related posts about dns