We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 34162
    • 1 Posts
    This is an auto-generated topic for <a href="http://modxcms.com/extras/package/570">SSL 1.0-GA</a> by therebechips.

    Brief Description:
    For sites using a SSL certificate, these plugins manage switching between pages that you want to serve securely with https:// and other pages that you want to serve as http://.
      • 1343 ☆ A M B ☆
      • 2,213 Posts
      Just wanted to note this works GREAT!

      Thanks for sharing!
        Patrick | Server Wrangler
        About Me: Website | Tweets |  MODX Hosting
        • 407
        • 10 Posts
        Hi i have installed this mod and i cant seem to get it to work correclty is it compatible with search engine friendly urls?
          • 1343 ☆ A M B ☆
          • 2,213 Posts
          Yes, are you getting any kind of error message?
            Patrick | Server Wrangler
            About Me: Website | Tweets |  MODX Hosting
            • 29774
            • 386 Posts
            therebechips Reply #5, 17 years ago
            Original author here: I can’t seem to update the instructions on the package page or change the first post here to add in the instructions, so I’ll just post them here:

            HOW TO USE:

            Use this custom placeholder in your template head:
            <base href="((base.href))" />


            Prepend this placeholder to links that must always point to https regardless if the page the link appears on is encrypted or not:
            ((secure.server))


            Prepend this placeholder to links that must always point to http regardless if the page the link appears on is encrypted or not:
            ((insecure.server))


            (Note that using these last two placeholders should only be necessary for forms that POST data to another page, eg login forms and search forms where you don’t want the page to redirect thus losing your POSTed data).

            Create a TV called ’encryption’, make it a checkbox and set the input option value: Yes==1

            Assign the TV to all your templates and check the checkbox for pages that will you want SSL

            Create a plugin called SSL, copy ssl.txt into it and and tick the OnWebPageInit event.
            (Be sure to change the $secureserver and $insecureserver values to the actual url of your server)

            Now create a second plugin called SSL-PH with the code in ssl-ph.txt and check the OnWebPagePrerender event.
              Snippets: GoogleMap | FileDetails | Related Plugin: SSL
              • 18174
              • 116 Posts
              Thanks therebechips for your advice to update to the latest revision. Now it runs also with cached pages, at least I hope it does in future.

              Two recommendations from my side:
              To set the servernames in the ssl plugin as parameters, update the plugincode as follows ~line 12:
              // server paths - no trailing slash!
              $secureserver	= isset($secureserver ) ? $secureserver : 'https://www.mysite.com';
              $insecureserver	= isset($insecureserver ) ? $insecureserver : 'http://www.mysite.com';


              and set the parameter prefs like this for plugin-config:
              &secureserver=secure Host;text;https://www.mysite.com &insecureserver=unsecure Host;text;http://www.mysite.com


              As I don’t get checkbox tv’s run as inherited, I define the encryption tv as listbox tv @INHERIT. This allowes me to set encryption on a parent in the document tree, all documents underneath are secured.
              This needs a small modification in your ssl module code ~line 16:
              $id = $modx->documentIdentifier;
              //$tv = $modx->getTemplateVar('encryption', "", $id);
              //$encryption = $tv['value']; // will be set to false if not set
              $tv = $modx->getTemplateVarOutput('encryption');  EM~ mod for @inherited TVs
              $encryption = $tv['encryption']==1;  EM~ mod for @inherited TVs

              I hope this helps anybody else. This plugin helpes me much.
              Regards
              manu


                • 5340
                • 1,624 Posts
                Just wanted to say that if your secure server is running on a diffrent port you might have to change
                } elseif ($_SERVER['SERVER_PORT'] == 443) {


                into

                } elseif ($_SERVER['SERVER_PORT'] == YOUR PORT) {


                Maybe this can be added as a configuration setting

                Thx
                  • 27330
                  • 884 Posts
                  thanks for sharing this.
                  I’m using it on my site and noticed that now if someone hits wrong url they get modx parse error instead of my
                  custom 404 page.

                  « Execution of a query to the database failed - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 »
                        SQL: SELECT tv.*, IF(tvc.value!='',tvc.value,tv.default_text) as value FROM `smartsecurity`.`modx_site_tmplvars` tv INNER JOIN `smartsecurity`.`modx_site_tmplvar_templates` tvtpl ON tvtpl.tmplvarid = tv.id LEFT JOIN `smartsecurity`.`modx_site_tmplvar_contentvalues` tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '' WHERE tv.name IN ('encryption') AND tvtpl.templateid = 


                  anyone else have this issue?
                    • 29774
                    • 386 Posts
                    I don’t think this is related to my plugins, but I might be wrong. Certainly my custom 404s work fine. If you disable the plugins does the same error occur?
                      Snippets: GoogleMap | FileDetails | Related Plugin: SSL
                      • 27330
                      • 884 Posts
                      yep positive. if the plugin is disabled my 404 page shows up.
                      I wasn’t sure it’s the plugin but look inside the sql it mention "WHERE tv.name IN (’encryption’) AND tvtpl.templateid"