On the edge of desperation. Multiple contexts and XRouting (but possibly unrelated)

Summary

I think i am going insane

Situation

I have a MODX installation with a dozen contexts.
They are all pretty much clones of each other with slightly different styles and various access permissions based on user groups. I use Xrouting to direct each context to each domain. All the settings base_url, http_host, cultureKey, site_start, site_url are correctly configured accordingly.

There are no WAFs or CDNs involved. Domains point straight to a dedicated cPanel hosting with all domains parked on top of the same account.

Access permits are the same as all other working contexts.

All context used to work correctly but for the past 4-5 days the last two: associazionealar.it and ccnlprof.it, endlessly load until max execution time then you get either a connection drop, a page not found standard error or a 503 error depending on the environment.

Server error log reports:
[Thu Nov 24 13:14:30.593234 2022] [fcgid:warn] [pid 17372:tid 47026302899968] [client ip] mod_fcgid: read data timeout in 600 seconds
[Thu Nov 24 13:14:30.593292 2022] [core:error] [pid 17372:tid 47026302899968] [client ip] End of script output before headers: index.php

We increased the server performance, thinking it was a power issue. No luck.
Tried completely disabling cache. No luck.
Forcefully removed cache folder. No luck.
Emptied sessions and permissions. No luck.
Even dropped the session table straight from the DB. No luck
Different PHP versions. No luck.
Local environment. No luck. (So it doesn’t seem to be a server issue)
Changed templates, even empty ones. No luck
Created a new empty context from scratch pointing to one of the two domains (after disabling the original one). No luck.

Observed behavior

If i use one of the “broken” domains as a gateway to access the manager (eg associazionealar.it/bnz-cms) i can login and then navigate the website without a hitch, as long as i’m logged. So it does work after all. Once logged off it all goes to hell again.
If i try a static files on the server it gets loaded (eg. associazionealar.it/test.txt)

Reverting htaccess to stock didn’t affect it. All context get loaded bar the last two.

Call for help

I’m completely at loss here… I don’t know where to bang my head anymore.
But they all used to work. And they work if i’m logged from the specific domain.

Environment

Apache + PHP 7.2 / 7.4 - Modx 2.6.5
Also tried locally and on a different production server with dummy temp domains. Upgraded to 2.8.4 in both occasions. The situation is persistent

Sounds like you need to investigate towards ACLs and error pages. It may be getting thrown into a loop trying to render an error in a potentially different context. Does each context have its own 404 resource and associated error_page + unauthorized_page context settings?

It’s also worth checking if XRouting has all the info it needs. Enable the xrouting.allow_debug_info system setting, and navigate to your broken domain with ?xrouting-debug=1 added to the url. Does that list all contexts and the expected selected context/routing?

Oh Mark you beautiful beautiful creature :heart:!!

So. Not all contexts had an error_page defined but that wasn’t the problem.

It was ACLs indeed. Every context has sort of a “reserved area” managed with the login plugin and the client is autonomous in defining all those groups and users and whatnot… the thing is they’re pretty clumsy and must’ve deleted a few
records for the Anonymous Group > Resource Access

Basically it was missing the 3 “public content” rules making it unaccessible.

This also explains why loggin on the specific domain and browsing as administrator made it work.

I was so convinced it was some weird server/php/whatever issue that i completely overlook the simplest solution.

Thanks for nudging me on the right path!!!

2 Likes