This is my first time developing a single core multi-context modx development serving two separate domain names. So the two domain requestions are correctly being picked up by by the gateway plugin and delivered to the correct context.
The problem I'm having is that if I edit a template for a document on the second context the second domain suddenly switches to the main context (serving the first domain) and I have to kickstart it back to working by going into the context settings and making a change and saving, then it works as it should. Has anyone else experienced this before.
-
MODX Staff
- 10,725 Posts
That's an odd problem. What Context Setting( s ) are you changing and saving to get it to work?
any, just editing it so the save option is available. I'm using the latest version of revo (2.2.4). tried it with the contextRouter and exactly the same issue as that with Gateway.
ok just done some more testing and updating the context settings is just coincidental. The issue is if I edit the template and then refresh the page, the second domain switches and shows the content for domain 1 (although domain 2 still shows in the address bar). Refreshing, clearing cache in modx and browser does nothing to save this, but if I then visit domain 1 and then go back to domain 2 (address bar) the correct context is switched to...so is this indeed something to do with caching and if so why is it triggered by editing a template and why does not clearing the cache fix it?
I'm kinda struggling to find any consistency in this issue. My main page of context 2 calls the login plugin which so far hasnt worked at all. Then without any changes up it popped, I edited the template applied to that document again, same issue - switched back to context 1, went through procedure above to get context 2 again and login has disappeared...just very very odd. Going to keep working until I can find out why this is happening but if anyone has any ideas I'd most appreciate some ideas.
further to this, ignore editing the template alltogether. If i go to domain 2 when its correctly working, I then clear the cache in the manager, go back to domain2 and refresh the browser it reverts to domain 1 template and content (with domain 2 in address bar, but without wayfinder menu which is working if i visit domain 1), refreshing does nothing. I then visit domain 1 and when I go back to domain 2 it's working as it should again (but login plugin isn't working ).
[ed. note: enoch1 last edited this post 14 years, 3 months ago.]
plot thickens, I created a snippet which just echo's a simple message to see if this is why other snippets weren't working in context2 and even that doesn't work. So there must be some setting at the route of all these issues I'm experiencing.
-
MODX Staff
- 10,725 Posts
You mentioned these contexts represented different domains. If that is the case, they can not share sessions; each unique domain will have it's own unique session. IOW, you cannot use a Login snippet in one Context to log that user into the other Context, because that other Context has a separate session that is not connected to the Context containing the Login snippet. This will ONLY work if you configure session sharing across Contexts, and this capability is ONLY available across sub-domains due to the way PHP sessions work.