We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 40735
    • 119 Posts
    Hi!
    Our ITS department upgraded the web server over the holidays and didn't bother to do any load testing. When everyone came back and the load got high the site became unresponsive. After blocking all external traffic to the site for four hours in the middle of the day they finally decided to revert to a snapshot taken before the upgrade. Since then we've started getting 404 errors anytime the trailing slash is not added to the URL. Does anyone know why this might happen? When the snapshot was taken this was not an issue. The FURL settings and my .htaccess file appear to be unchanged. I'm stumped. If it makes a difference, only the file system and not the database was rolled back.

    Help? Thanks! [ed. note: dwillis210 last edited this post 11 years, 8 months ago.]
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Is this a snapshot of the entire server, or just of the MODX installation?
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 40735
        • 119 Posts
        Quote from: sottwell at Jan 07, 2015, 11:11 AM
        Is this a snapshot of the entire server, or just of the MODX installation?

        I understood it to be the entire server. Apparently sweeping changes were made to it with updates to many services and RHEL itself.
          • 40735
          • 119 Posts
          MODX seems to be stripping the trailing slashes off of the URI for resources that are not containers. Where can I control this behavior? I don't see a setting for it under FURLs or a RewriteRule for it in the htaccess.

          This is a most perplexing problem. It doesn't happen on every page. I can't find a pattern to when it happens and when it doesn't. If anyone wants to see it in action, check this out:

          Pages like this work with or without the trailing slash:
          https://www.tntech.edu/internationaladmissions
          https://www.tntech.edu/internationaladmissions/

          But pages like this only work with it:
          https://www.tntech.edu/library/
          https://www.tntech.edu/library

          https://www.tntech.edu/admissions/
          https://www.tntech.edu/admissions

          They're all containers. They all have children. I don't get it.
            • 40735
            • 119 Posts
            I think the issue may lie in something related to the "freeze URI" setting. On one page that was having the issue I froze the URI, removed the trailing slash from the value in the field and saved and cleared the cache. Then the page loaded without the trailing slash but not with it. Next I unfroze the URI and again saved and cleared the cache. Now it loads without the trailing slash and if I add the slash it gets stripped. I don't understand why the value of "freeze URI" is having an impact even when it's not checked but it certainly seems to be. Unfortunately we have ~12K pages and it just not feasible to freeze and unfreeze all of them. I really need to know why it broke.
              • 22840
              • 1,572 Posts
              Not sure what they could have done to cause it but try adding the following code to the bottom of the .htaccess file, it should add the trailing slash to anything that doesnt have it

              <IfModule mod_rewrite.c>
               RewriteCond %{REQUEST_URI} /+[^\.]+$
               RewriteRule ^(.+[^/])$ %{REQUEST_URI}/ [R=301,L]
              </IfModule>
                • 40735
                • 119 Posts
                Quote from: paulp at Jan 07, 2015, 02:41 PM
                Not sure what they could have done to cause it but try adding the following code to the bottom of the .htaccess file, it should add the trailing slash to anything that doesnt have it

                <ifmodule mod_rewrite.c="">
                 RewriteCond %{REQUEST_URI} /+[^\.]+$
                 RewriteRule ^(.+[^/])$ %{REQUEST_URI}/ [R=301,L]
                </ifmodule>

                I've actually tried that already but for some reason certain pages wind up with redirect loops when I do it. It looks like modx strips trailing slashes off of resources that aren't containers and then htaccess adds them back, ad infinitum.

                I'm wondering if there's some weirdness going on with the freeze URI feature. There has been a time or two in the past where we had issues that were only resolved by freezing and unfreezing the URI. I don't remember the details though.
                  • 22840
                  • 1,572 Posts
                  In your system settings filtered by friendly urls what do you have in friendly_alias_trim_chars ?, mine is /.-_ so you could try editing that and remove the /
                    • 40735
                    • 119 Posts
                    Quote from: paulp at Jan 07, 2015, 02:50 PM
                    In your system settings filtered by friendly urls what do you have in friendly_alias_trim_chars ?, mine is /.-_ so you could try editing that and remove the /

                    It's the same as yours. I'll try that and see if it fixes my looping issue. I bet it will. I'd still like to know what the underlying issue is though.


                    Edit:
                    Well, that didn't work after all. I removed the slash from friendly_alias_trim_chars setting and I cleared the cache but the trailing slash is still being stripped from pages that are not containers.
                      • 40735
                      • 119 Posts
                      Some further weirdness with the freeze URI setting. There are three pages I've been working with trying to troubleshoot this problem. On all three of them I've checked "freeze URI" and removed the trailing slash from the field, saved and cleared the cache. This works fine. Then when I go back and uncheck "freeze URI" and save and clear the cache, on two of the pages I notice that the trailing slash gets added back to the field. On the third it stays the way I left it. The one that stays the way I left it continues to work but the two the have the trailing slash added back cease working and return 404. But on all three of them the "freeze URI" option is unchecked.

                      Why would "freeze URI" continue to have an impact even when it's not checked? And why do some pages revert the change and others don't? Very strange, very strange... [ed. note: dwillis210 last edited this post 11 years, 8 months ago.]