Live Helper Chat support forum.. Forum is locked. New place for questions - Github Discussions
You are not logged in.
Hi,
I have read your docs about the CORS policy for Apache and Nginx. I have added the required code, but I get the following error message when I look at the browser console:
[== Undefined ==]
Access to XMLHttpRequest at 'https://livehelper.caifan.casa/index.php/en/widgetrestapi/settings?vid=04106230abe9a53e237c&tz=America%2FToronto&r=%252F%252Fcaifan.casa%252Fmontreal%252Fmenus&l=%252F%252Fcaifan.casa%252F&dt=Online%2520Order!%2520-%2520Caifan&dep=1&theme=1' from origin 'https://caifan.casa' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header contains multiple values '*, https://caifan.casa', but only one is allowed.
helperFunctions.js:163
GET https://livehelper.caifan.casa/index.php/en/widgetrestapi/settings?vid=04106230abe9a53e237c&tz=America%2FToronto&r=%252F%252Fcaifan.casa%252Fmontreal%252Fmenus&l=%252F%252Fcaifan.casa%252F&dt=Online%2520Order!%2520-%2520Caifan&dep=1&theme=1 net::ERR_FAILED
value *** helperFunctions.js:163
r *** index.js:259
(anonymous) *** index.js:837
(anonymous) *** index.js:847
LiveHelperChat *** index.js:1
s *** bootstrap:63
LiveHelperChat *** bootstrap:200
(anonymous) *** index.js?20201115:1
So I have ran a grep command in order to find where the header is multiplied. Here are the locations where that header is set:
[== Undefined ==]
/var/www/vhosts/caifan.casa/livehelper.caifan.casa/lib/core/lhrestapi/lhrestapivalidator.php: header('Access-Control-Allow-Origin: *');
/var/www/vhosts/caifan.casa/livehelper.caifan.casa/lib/core/lhcore/UploadHandler.php: $this->header('Access-Control-Allow-Origin: '.$this->options['access_control_allow_origin']);
/var/www/vhosts/caifan.casa/livehelper.caifan.casa/doc/http_conf_examples/.htaccess.example: Header always Set Access-Control-Allow-Origin "*"
/var/www/vhosts/caifan.casa/livehelper.caifan.casa/modules/lhchat/logevent.php:header('Access-Control-Allow-Origin: *');
/var/www/vhosts/caifan.casa/livehelper.caifan.casa/modules/lhchat/extendcookie.php:header('Access-Control-Allow-Origin: *');
/var/www/vhosts/caifan.casa/livehelper.caifan.casa/modules/lhchat/updatejsvars.php:header ( 'Access-Control-Allow-Origin: *' );
/var/www/vhosts/caifan.casa/livehelper.caifan.casa/modules/lhchat/setnewvid.php:header ( 'Access-Control-Allow-Origin: *' );
/var/www/vhosts/caifan.casa/livehelper.caifan.casa/modules/lhchat/updateattribute.php:header ( 'Access-Control-Allow-Origin: *' );
/var/www/vhosts/caifan.casa/livehelper.caifan.casa/modules/lhchat/refreshcustomfields.php:header('Access-Control-Allow-Origin: *');
/var/www/vhosts/caifan.casa/livehelper.caifan.casa/modules/lhfile/storescreenshot.php:header('Access-Control-Allow-Origin: *');
/var/www/vhosts/caifan.casa/livehelper.caifan.casa/modules/lhrestapi/startchat.php:header('Access-Control-Allow-Origin: *');
/var/www/vhosts/caifan.casa/livehelper.caifan.casa/modules/lhrestapi/logout.php:header('Access-Control-Allow-Origin: *');
/var/www/vhosts/caifan.casa/livehelper.caifan.casa/modules/lhrestapi/swagger.php:header('Access-Control-Allow-Origin: *');
/var/www/vhosts/caifan.casa/livehelper.caifan.casa/modules/lhrestapi/setoperatorstatus.php:header('Access-Control-Allow-Origin: *');
/var/www/vhosts/caifan.casa/livehelper.caifan.casa/modules/lhrestapi/departaments.php:header('Access-Control-Allow-Origin: *');
/var/www/vhosts/caifan.casa/livehelper.caifan.casa/modules/lhrestapi/setinvisibilitystatus.php:header('Access-Control-Allow-Origin: *');
/var/www/vhosts/caifan.casa/livehelper.caifan.casa/modules/lhrestapi/login.php:header('Access-Control-Allow-Origin: *');
/var/www/vhosts/caifan.casa/livehelper.caifan.casa/modules/lhrestapi/setnewvid.php:header('Access-Control-Allow-Origin: *');
/var/www/vhosts/caifan.casa/livehelper.caifan.casa/modules/lhcobrowse/storenodemap.php:header('Access-Control-Allow-Origin: *');
/var/www/vhosts/caifan.casa/livehelper.caifan.casa/modules/lhcobrowse/finishsession.php:header('Access-Control-Allow-Origin: *');
So, from there, I don't know what to do... Could it be possible that header in those php files is causing issues?
Thanks in advance
Offline
Hi,
You did not told what you are using nginx or apache.. If nginx you can try to remove rules under " location / {" section.
Offline
Apache with nginx as proxy. Should I try as you suggested for nginx?
Offline
But where does the main configuration comes from nginx or apache. As for nginx there headers set for php files under " location / {" so just try to remove them. Headers in php is fine as long server itself does not send them again for php request...
Offline