[Virtuemart] Refused to set unsafe header "Connection"
While I was working on a Joomla 1.5.18, Virtuemart 1.1.4 website, I encounter this problem of "not able to add to cart" problem with Virtuemart.
When "Inspect Element" in Chrome, I got the following error
Apparently, after debugging for a while, I found out that for Ajax calls, example.com and www.example.com are considered different domain, thus the considered as unsafe "Connection"
Solution
The solution for this is pretty straight forward - make sure you are at the correct domain. To do this, create/add the following code in the .htaccess file in your public_html directory.
That is by far the easiest way to solve this issue.
When "Inspect Element" in Chrome, I got the following error
Refused to set unsafe header "Connection"
XMLHttpRequest cannot load http://www.example.com/index.php. Origin http://example.com is not allowed by Access-Control-Allow-Origin.
Apparently, after debugging for a while, I found out that for Ajax calls, example.com and www.example.com are considered different domain, thus the considered as unsafe "Connection"
Solution
The solution for this is pretty straight forward - make sure you are at the correct domain. To do this, create/add the following code in the .htaccess file in your public_html directory.
RewriteEngine onNote: Replace example.com with your domain.
RewriteCond %{http_host} ^example.com$ [nc]
RewriteRule ^(.*)$ http://www.example.com/$1 [r=301,nc]
That is by far the easiest way to solve this issue.
you're my savior! Thank you very much! Just a clirification: the 2 rows are queued to the file! Else don't work! Thanks a lot
ReplyDelete