ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Wordpress Install - Page is trying to load unsafe script

    IT Discussion
    fedora 27 nginx wordpress
    4
    28
    4.2k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • NashBrydgesN
      NashBrydges @Obsolesce
      last edited by

      @tim_g said in Wordpress Install - Page is trying to load unsafe script:

      Try adding this to the bottom of wp-config.php:

      if($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https'){
      
          $_SERVER['HTTPS'] = 'on';
          $_SERVER['SERVER_PORT'] = 443;
      }
      

      Added this but no change. Still getting the error. Looks like there are javascript being served via http instead of https.

      1 Reply Last reply Reply Quote 0
      • NashBrydgesN
        NashBrydges @Obsolesce
        last edited by

        @tim_g said in Wordpress Install - Page is trying to load unsafe script:

        I just looked again, and seen this as being blocked (but shows a green lock because FF is automatically blocking it):

        0_1520980046984_d90e259e-658c-4446-92df-074ec981a52d-image.png

        Yeah I changed the theme to sixteen to see if that changed anything but still getting mixed content warnings.

        1 Reply Last reply Reply Quote 0
        • NashBrydgesN
          NashBrydges
          last edited by

          I think because my URLs on the Settings tab are still showing HTTP instead of HTTPS, the scripts are being served up via HTTP. But if I change the URLs to HTTPS, browser errors out with too may redirects.

          1 Reply Last reply Reply Quote 0
          • ObsolesceO
            Obsolesce
            last edited by

            @nashbrydges said in Wordpress Install - Page is trying to load unsafe script:

            @tim_g said in Wordpress Install - Page is trying to load unsafe script:

            Try adding this to the bottom of wp-config.php:

            if($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https'){
            
                $_SERVER['HTTPS'] = 'on';
                $_SERVER['SERVER_PORT'] = 443;
            }
            

            Added this but no change. Still getting the error. Looks like there are javascript being served via http instead of https.

            Did you add use this without the URLs set to https on the main settings page?

            NashBrydgesN 1 Reply Last reply Reply Quote 0
            • NashBrydgesN
              NashBrydges @Obsolesce
              last edited by

              @tim_g I added the code lines to the bottom of wp-config.php as well as set both fields in Settings to https.

              Doesn't work. Get a too many redirects error.

              ObsolesceO 1 Reply Last reply Reply Quote 0
              • ObsolesceO
                Obsolesce @NashBrydges
                last edited by

                @nashbrydges said in Wordpress Install - Page is trying to load unsafe script:

                @tim_g I added the code lines to the bottom of wp-config.php as well as set both fields in Settings to https.

                Doesn't work. Get a too many redirects error.

                Try the code without the urls changed

                1 Reply Last reply Reply Quote 0
                • JaredBuschJ
                  JaredBusch
                  last edited by

                  I used a plugin to fix ssl last time I I’d to do this.

                  No idea what the plugin was anymore.

                  ObsolesceO 1 Reply Last reply Reply Quote 0
                  • ObsolesceO
                    Obsolesce @JaredBusch
                    last edited by

                    @jaredbusch said in Wordpress Install - Page is trying to load unsafe script:

                    I used a plugin to fix ssl last time I I’d to do this.

                    No idea what the plugin was anymore.

                    This one?
                    https://wordpress.org/plugins/ssl-insecure-content-fixer/

                    JaredBuschJ 1 Reply Last reply Reply Quote 2
                    • black3dynamiteB
                      black3dynamite
                      last edited by

                      Force SSL Plugin
                      https://wordpress.org/plugins/wp-force-ssl/

                      Administrator over SSL
                      https://codex.wordpress.org/Administration_Over_SSL

                      JaredBuschJ 1 Reply Last reply Reply Quote 2
                      • JaredBuschJ
                        JaredBusch @Obsolesce
                        last edited by

                        @tim_g said in Wordpress Install - Page is trying to load unsafe script:

                        @jaredbusch said in Wordpress Install - Page is trying to load unsafe script:

                        I used a plugin to fix ssl last time I I’d to do this.

                        No idea what the plugin was anymore.

                        This one?
                        https://wordpress.org/plugins/ssl-insecure-content-fixer/

                        Either this one or

                        1 Reply Last reply Reply Quote 0
                        • JaredBuschJ
                          JaredBusch @black3dynamite
                          last edited by

                          @black3dynamite said in Wordpress Install - Page is trying to load unsafe script:

                          Force SSL Plugin
                          https://wordpress.org/plugins/wp-force-ssl/

                          This one

                          1 Reply Last reply Reply Quote 0
                          • JaredBuschJ
                            JaredBusch
                            last edited by

                            I recall both names. Not sure which one worked.

                            ObsolesceO 1 Reply Last reply Reply Quote 0
                            • ObsolesceO
                              Obsolesce @JaredBusch
                              last edited by

                              @jaredbusch said in Wordpress Install - Page is trying to load unsafe script:

                              I recall both names. Not sure which one worked.

                              To force SSL you don't need any add-on.
                              I don't use one for my WordPress sites anywhere.

                              But I can see needing one to properly handle forwarding from a reverse proxy.

                              I have never used WP behind a reverse proxy so who knows.

                              JaredBuschJ 1 Reply Last reply Reply Quote 0
                              • ObsolesceO
                                Obsolesce
                                last edited by

                                I'm going to set up an nginx reverse proxy sometime to see what exactly is going on.

                                1 Reply Last reply Reply Quote 0
                                • JaredBuschJ
                                  JaredBusch @Obsolesce
                                  last edited by JaredBusch

                                  @tim_g said in Wordpress Install - Page is trying to load unsafe script:

                                  @jaredbusch said in Wordpress Install - Page is trying to load unsafe script:

                                  I recall both names. Not sure which one worked.

                                  To force SSL you don't need any add-on.
                                  I don't use one for my WordPress sites anywhere.

                                  But I can see needing one to properly handle forwarding from a reverse proxy.

                                  I have never used WP behind a reverse proxy so who knows.

                                  Correct, this is an issue when it is behind a proxy that is handling the SSL.

                                  I would guess that if you setup WP to use a self signed cert and put that behind the proxy, it would work as you expect.

                                  1 Reply Last reply Reply Quote 2
                                  • NashBrydgesN
                                    NashBrydges
                                    last edited by

                                    I'm going to have to try those solutions out when I'm back home.

                                    1 Reply Last reply Reply Quote 0
                                    • NashBrydgesN
                                      NashBrydges
                                      last edited by

                                      I finally figured out where this install went wrong.

                                      When running this command sudo -u apache wp core download I was getting this error:

                                      Downloading WordPress 4.9.4 (en_US)...
                                      Warning: Failed to create directory '/usr/share/httpd/.wp-cli/cache/': mkdir(): Permission denied.
                                      

                                      Once I manually created the folder and re-ran the commands right through to the end, everything worked as expected. Now the blog loads as a subfolder to the main site and doesn't have any issues with HTTPS warnings of any kind.

                                      1 Reply Last reply Reply Quote 4
                                      • black3dynamiteB
                                        black3dynamite
                                        last edited by

                                        @NashBrydges
                                        Change
                                        CustomLog /var/log/access.log combined
                                        to
                                        CustomLog /var/log/httpd/access.log combined

                                        NashBrydgesN 1 Reply Last reply Reply Quote 1
                                        • NashBrydgesN
                                          NashBrydges @black3dynamite
                                          last edited by

                                          @black3dynamite said in Wordpress Install - Page is trying to load unsafe script:

                                          @NashBrydges
                                          Change
                                          CustomLog /var/log/access.log combined
                                          to
                                          CustomLog /var/log/httpd/access.log combined

                                          Good catch. Thanks.

                                          1 Reply Last reply Reply Quote 0
                                          • 1
                                          • 2
                                          • 1 / 2
                                          • First post
                                            Last post