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

Written by Ian Carnaghan · 24 sec read >

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

Last Updated On March 25, 2018
Written by Ian Carnaghan
I am a software developer and online educator who likes to keep up with all the latest in technology. I also manage cloud infrastructure, continuous monitoring, DevOps processes, security, and continuous integration and deployment. Profile

Leave a Reply

Notify of