Refused to set unsafe header “Connection” when adding a product to cart in Virtuemart in Joomla! 1.5

No Comments

Complete Error:

Refused to set unsafe header “Connection”
XMLHttpRequest cannot load http://www.yourdomain.com/index.php. Origin http://yourdomain.com is not allowed by Access-Control-Allow-Origin.

This seems to happen whenever you access your domain via the domain url without the www record. So the Ajax calls that are made when adding a product to the cart seem to make calls to the www.yourdomain.com url and sees it as a different website.

A simple workaround is to place the following in your .htaccess file

RewriteEngine on
 
RewriteCond %{http_host} ^yourdomain.com$ [nc]
 
RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [r=301,nc]

Also remember to replace yourdomain.com with your website domain name

Image Credits: Photo by Isis França on Unsplash.

Last Updated On March 25, 2018

Related Articles

No results found

Leave a Reply

avatar
  Subscribe  
Notify of
Menu
Copy link