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 Origin 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 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} ^$ [nc]
RewriteRule ^(.*)$$1 [r=301,nc]

Also remember to replace with your website domain name

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

Related Articles

No results found.

Leave a Reply

Notify of