We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
  • Hello,

    First of all, I'm not a progammer.

    Because Site5 hosting arbitrarily changed A records without notifying us with some frequency and we had a lot of performance issues we moved two MODX based sites (each with 3 contexts) to A2 (A2 did a cPanel based migration from Site5).

    Note: Both MODX based installs are up to date at 2.6.5 and Extras updated before the move.

    Logged in the first time and everything was much faster.

    However, an issue has arised that I cannot solve.

    If we visit a context that is not the "web" context but another one with the correct Context Settings, ie.

    base_url: /
    http_host: domain.com
    site_url: http://domain.com/

    Obviously with real domains. The additional domains are Aliases in cPanel that point to public_html. At first was using ContextRouter for routing to contexts but have replaced it with xRouting. We have of course changed the A record for each domain to point to the new server.

    Every context renders so we know that the A records are fine and redirecting to the correct context is at least partially fine.

    But the issue is if we visit a URL for a context that is not "web" the server's CPU and Memory skyrockets and the sites eventually return a 500 error until after a few minutes when the server goes back to normal (we usually close the page we visited as well). When we go to the other context, of course, it's very slow right way, often refusing to render images.

    So I'm thinking there has to be an issue with routing but I can't figure out what it is.

    The main differences between the old server are:

    PHP 7.1 instead of 5.6
    Let's Encryt SSL is automatically installed

    And the following was added to the standard MODX .htacess:

    RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
    RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
    RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
    


    I commented them out but this made no difference.
    MODX error log shows nothing.

    On the other MODX install on A2 (different account then the other), when a user logs into the manager using a non "web" context again the server's CPU and Memory skyrockets and the sites eventually return a 500 error until after a few minutes when the server goes back to normal.

    At first we thought it was bots hitting the sites in bulk but have use robots.txt to deny most of them.

    My suspicion is it has something to do with the free SSL but we aren't trying to use https:// in any of the above situations.

    Anyone have any ideas or have had a similar experience?

    This question has been answered by rx2. See the first response.

      • 3749
      • 24,544 Posts
      I haven't encountered that, but I wonder if you've got some kind of circular routing that's bouncing back and forth between http and https as you navigate the site and instantiating MODX at each iteration.

      The server logs might tell you something about what's happening.
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
      • Quote from: BobRay at Nov 19, 2018, 05:45 PM
        I haven't encountered that, but I wonder if you've got some kind of circular routing that's bouncing back and forth between http and https as you navigate the site and instantiating MODX at each iteration.

        The server logs might tell you something about what's happening.

        Thanks. Have been looking through the logs but it just seems like normal traffic with only very few robots bothering with https: (at least according the ssl log). Added a date_timezone setting and the home pages of each non "web" context seemed to render faster but the server CPU still shot up to 44%. The templates for each of these other site's home page is almost straight HTML as well. It's very confusing.
        • discuss.answer
          I believe I found the issue.

          There were no error_page context setttings for each context (found that on this forum with another recommendation from Bob). Once I added those the spiking appears to have stopped. Will see how it goes the next few days.

            • 3749
            • 24,544 Posts
            That looks like it could be the problem. If you get sent to the home page in another context, XRouting might bounce you back to the original page in a loop.
              Did I help you? Buy me a beer
              Get my Book: MODX:The Official Guide
              MODX info for everyone: http://bobsguides.com/modx.html
              My MODX Extras
              Bob's Guides is now hosted at A2 MODX Hosting
            • Indeed and I understand the reason for the error_page setting with multiple contexts but I thought it was triggered when hitting an existing URL. At any rate, day 2 after this and all seems fine.
                • 3749
                • 24,544 Posts
                That's good to hear. smiley
                  Did I help you? Buy me a beer
                  Get my Book: MODX:The Official Guide
                  MODX info for everyone: http://bobsguides.com/modx.html
                  My MODX Extras
                  Bob's Guides is now hosted at A2 MODX Hosting