• When I run the console I get “Failed to load resource: net::ERR_INSECURE_RESPONSE” for every JavaScript on this site. I have the exact same wordpress code on another site which works fine. I am using only one SSL certificate for both sites, and this one, naturally, is in a different folder. But they both use the same code. The problem appears to be the same on all browsers, at least Edge, Chrome and Firefox.

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    It looks like you’re using relative URLS and URLs that point to your localhost.

    Relative URL:

    
    https:///themes/delight-spa/style.css?ver=4.9
    

    Localhost:

    
    https://localhost.localdomain/wp-includes/js/jquery/jquery.js?ver=1.12.4
    

    I’m struggling to see how that would work fine on another website; do you have the website URL at hand to show us?

    Thread Starter victor2preston

    (@victor2preston)

    The other website is “victorpreston.com”.
    The URLS that I see on the Settings->General page look like this:
    https://theserenecity.com”
    I see that in the database the siteurl is “http://localhost.localdomain”, and
    home is “http:/localhost”
    I’m not sure I understand – where is the php code finding these URLS? It’s a likely place to be the problem, but I would have thought relative URLS would be what you wanted, so it will look in the folder containing the correct code.
    The domain root for “victorpreston.com” is “/var/www/html”
    whereas the domain root for “theserenecity.com” is “/var/www/theserenecity.com/html”
    They each have WordPress installed in their corresponding domain root.

    Thread Starter victor2preston

    (@victor2preston)

    I see now (by looking at the console when accessing the site) that in addition to JavaScripts not loading, CSS pages are also not loading. I tried replacing the home url with the actual path on the local machine, but it made no difference. so it looks like it’s not an issue with location. Also the permissions on these files is 644, and the owner is “www-data” – that IS the user that wordpress uses, right?
    When the JavaScripts fail they return ERR_INSECURE_RESPONSE and when the CSS files fail they return ERR_NAME_NT_RESOLVED. But the files ARE there!

    Moderator bcworkz

    (@bcworkz)

    Sorry for the slow response, I only recently learned of your plight. It’s extremely unusual to see httрs://theserenecity.com in settings but in the DB siteurl and home entries contain localhost references. Are you sure you’re looking at the right DB? (Been there, done that, I’ll assume you have the right one) Some sort of filter code is then apparently changing the value. If it does so consistently, then it should be OK, but this arrangement makes site maintenance difficult because the domain is hard-coded in PHP somewhere, such that the DB entry is meaningless.

    But it apparently is not consistent because you have missing domains in supporting CSS and JS file references. This means functions like siteurl() are not returning valid values. I don’t know why some code is messing with site URLs, but it’s doing so incorrectly (setting certain constants in wp-config.php will do so correctly).

    Not knowing why this scheme is in place to begin with, I’m not sure my solution would be appropriate. If you want to try it anyway, make a full backup of everything just in case I’m off base. My inclination is to isolate whatever code is messing with domains and remove it (or comment it out), placing the proper values in the DB. You can narrow down the source by selectively deactivating modules until the responsible code is isolated. You can do so manually, or use the troubleshooting tab of the health-check plugin.

    That should resolve the external links, but there seems to be other issues with the sub-folder location and SSL certificates. I don’t think a SSL cert for one site will be valid for the other even if it is in a sub-folder of the covered site. I don’t think the SSL enforcement mechanism can “see” this arrangement, as far as it’s concerned they are two separate sites. I may be wrong, I’ve never tried such a scheme.

    You should consider switching the domain not named on the cert to normal HTTP protocol for a while in order to confirm everything else is working properly. Once you’ve confirmed it’s otherwise working, you can try HTTPS again. If it fails, you probably will need a separate cert for the site.

    www-data is frequently the default system user on many Apache installs, but it doesn’t have to be. WP does not get to pick what user it runs under, Apache uses what its configuration tells it to. Check the httpd.conf file or equivalent for the system user. Whatever it is, it should also be the owner of all WP files and folders. Alternate schemes are possible, but this is the most typical.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘All JavaScripts fail to load’ is closed to new replies.