cancel
Showing results for 
Search instead for 
Did you mean: 

JS Won't Load After Migrating From Localhost to Live

JS Won't Load After Migrating From Localhost to Live

Hello,

 

So everything works fine on my localhost using xampp phpmyadmin etc. all works fine, I have no errors.

 

I have migrated whole website to live server, php version is 7.3.17 while magento is 2.3.5 everything works fine, site loads, css loads, site is working yet there is one error that just amazes me and I don't even know how its possible that it occurs.

 

https://gyazo.com/414246625ccc50cb7ecb1f20f0036e45

 

On this screenshot you can see the errors I got in console, I got no errors from php or in logs folder....

 

Here is my "beta" or so site before i move it to production (currently have magento 1 there) 
https://pneumatig.eu/

Here is my magento 2 version that I migrated and you can right click and check the console for some wierd errors, I don't even know where does 'pneuAmtig' comes from, I have searched whole database for this, searched all folder - every file has been scanned for this and there is NO trace of this ANYWHERE.

Im also not using anywhere site name in any phtml or php file, just standard functions to receive site name...

 

Can anybody please help me? Im running out of my mind to get this fixed...

8 REPLIES 8

Re: JS Won't Load After Migrating From Localhost to Live

Can somoene help me with this? I cant figure out this, how its possible that this is happening take a look at below screenshots:

https://gyazo.com/d5e1cf31518560647472b5d0d1d01db8

 

And look here in database

https://gyazo.com/c6906853f596c4358a8ee65572b124be

 

The files that its trying to load, are not hard coded anywhere in the code, I have searched as previously mentioned, every file in my root folder for trace of "pneuAmtig" and its nowhere to be found...

 

Also its a direct clone from my localhost which works fine!!!!! 

 

How the hell do I fix this??? 

Re: JS Won't Load After Migrating From Localhost to Live

Hi,

I also have this violation errors in a new 2.3.5 installation. From what i see, this is a new security feature. By default you can't load external js, img, frames unless you whitelist the domains that this files are hosted.

I managed to fixed this errors by editing file

/vendor/magento/module-cardinal-commerce/etc/csp_whitelist.xml 

 for example, in script-src, i have added the lines

<value id="sharethisbuttonsapi" type="host">platform-api.sharethis.com</value>
                <value id="sharethisbuttonsconfig" type="host">buttons-config.sharethis.com</value>
				<value id="gstaticrecaptcha" type="host">gstatic.com</value>
				<value id="gstaticrecaptcha2" type="host">https://www.gstatic.com</value>
				<value id="googlecaptcha" type="host">google.com</value>
				<value id="googleapis" type="host">apis.google.com</value>
				<value id="googleapishttps" type="host">https://www.google.com</value>

also the following

<policy id="img-src">
            <values>
                
				<value id="sharethisbuttonsapi" type="host">platform-api.sharethis.com</value>
				<value id="sharethisplatformcdn" type="host">platform-cdn.sharethis.com</value>
                <value id="sharethisbuttonsconfig" type="host">buttons-config.sharethis.com</value>
				<value id="gstaticrecaptcha" type="host">gstatic.com</value>
				<value id="googlecaptcha" type="host">google.com</value>
				<value id="googleapis" type="host">apis.google.com</value>
				<value id="googleapishttps" type="host">https://www.google.com</value>
            </values>
        </policy>
		<policy id="font-src">
            <values>
                <value id="fontsgstatic" type="host">fonts.gstatic.com</value>
				<value id="fontsgoogleapis" type="host">fonts.googleapis.com</value>
				<value id="googlecaptcha" type="host">google.com</value>
            </values>
        </policy>
		<policy id="style-src">
            <values>
                <value id="fontsgstatic" type="host">fonts.gstatic.com</value>
				<value id="fontsgoogleapis" type="host">fonts.googleapis.com</value>
				<value id="googlecaptcha" type="host">google.com</value>
            </values>

I think yours are different urls, im using a premium theme and i had to add those.

To check if its ok, you have to clear storage cache

 

I would be very pleased if someone can reply with a better solution regarding a better place where the above lines should be added without losing anything after an update of the module. 

 

Regards

George

Re: JS Won't Load After Migrating From Localhost to Live

And this is the article that helped me, its translated from russian

https://translate.google.gr/translate?hl=el&tab=wT&sl=auto&tl=en&u=https%3A%2F%2Fitnan.ru%2Fpost.php...

Re: JS Won't Load After Migrating From Localhost to Live

But this is from my own domain so why do I have to whitelist my own domain? Its about the site name being wrong! In my database I have "PNEUMATIG" and site wants to load "pneuAMtig" see, letters are out of their place, how is that possible?

 

Also worth mentioning, that site loads fine and some js files wont load because of 

Failed to load resource: net::ERR_NAME_NOT_RESOLVED

 

And the thing you mentioned, just lol... I have to tinker in configuration files to load something externally? god...

Re: JS Won't Load After Migrating From Localhost to Live

Perhaps the file in your domain calls something outside your domain, i also had this problem.

If i knew this would happen, i would choose an older version, what can i say...

Re: JS Won't Load After Migrating From Localhost to Live

Its really important that you mentioned this, Im for sure I will encounter this problem later on, but Im 99% certain that this wont solve my problem, I have wrote these and I know they are not calling anything from the web.

 

Anyway your post surely will help me out in the future, thank you. Also this kind of "security" is stupid lol

Re: JS Won't Load After Migrating From Localhost to Live

I can confirm this happens on my localhost also when I ugraded from 2.3.3 to 2.3.5 so there is certainly something with 2.3.4 or 2.3.5 Im going to further investigate because looks like I wont receive much help here lol

Re: JS Won't Load After Migrating From Localhost to Live

-