Reputation: 60
I have an error when try to put my chat on my webiste
Failed to load https://chat.example.com/socket.io/?EIO=3&transport=polling&t=MBK-pzZ: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://example.com' is therefore not allowed access. The response had HTTP status code 503.
on my VH on apache I did:
<VirtualHost 1.1.1.1:443>
SSLEngine on
ServerName www.example.com
ServerAlias www.example.com example.com
ServerAdmin [email protected]
DocumentRoot /home/myuser/public_html
UseCanonicalName OFF
<Directory /home/myuser/public_html>
Options None
Options +FollowSymLinks
Header add Access-Control-Allow-Origin "*"
Header add Access-Control-Allow-Headers "origin, x-requested-with, content-type"
Header add Access-Control-Allow-Methods "PUT, GET, POST, DELETE, OPTIONS"
</Directory>
</VirtualHost>
but it's not help. using apache 2.4
thanks
Upvotes: 1
Views: 140
Reputation: 9373
You can also put these lines in .htacces file to fix this issue.
Header add Access-Control-Allow-Origin "*"
Header add Access-Control-Allow-Headers "origin, x-requested-with, content-type"
Header add Access-Control-Allow-Methods "PUT, GET, POST, DELETE, OPTIONS"
Upvotes: 0
Reputation: 60
It was with my apache configuration the "httpd-default.conf"
I found this 2 lines:
Header set Access-Control-Allow-Origin "*"
Header always set Access-Control-Allow-Origin "*"
when i remove it, it's works
thanks!
Upvotes: 1