-
Notifications
You must be signed in to change notification settings - Fork 512
The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' error in laravel-echo-server #162
Comments
You should return the requesting origin as allowed origin, instead of * |
@barryvdh, How can I do ? please guide me more |
You could try https://github.com/barryvdh/laravel-cors |
is not possible some tasks in socket io client side to solve this problem? |
Oh sorry, client side of course. Perhaps https://github.com/expressjs/you can then,? |
How can I use Node.js CORS along with your |
@ahmadbadpey Hey, I've been trying to get CORS working with this. You need to set See:
|
@ahmadbadpey did you ever made it work with the solution suggested by dav-is? |
@aftabnaveed , No I did not try it. |
Getting this same error. I can see the events being read and broadcast via the log, but the front-end app is getting the CORS error and not updating. I've tried setting the Tried it both with, and without, a client. Completely stumped. Started happening after composer update. Maybe something changed with Laravel event broadcasting? Using:
Current error: Failed to load https://echo.test:6001/socket.io/?EIO=3&transport=polling&t=ML3pRSC: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'. Origin 'https://echo.test' is therefore not allowed access. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute. Example of current config {
"authHost": "https://echo.test",
"authEndpoint": "/broadcasting/auth",
"clients": [
{
"appId": "EchoTest",
"key": "123sdfg1sdf1g321sdf2fg13ds2ff1g3"
}
],
"database": "redis",
"databaseConfig": {
"redis": {},
"sqlite": {}
},
"devMode": true,
"host": null,
"port": "6001",
"protocol": "https",
"socketio": {},
"sslCertPath": "/Users/me/Sites/_SSL/echo/echo.test.crt",
"sslKeyPath": "/Users/me/Sites/_SSL/echo/echo.test.key",
"sslCertChainPath": "",
"sslPassphrase": "",
"apiOriginAllow": {
"allowCors" : true,
"allowOrigin" : "https://echo.test",
"allowMethods" : "GET, POST",
"allowHeaders" : "Origin, Content-Type, X-Auth-Token, X-Requested-With, Accept, Authorization, X-CSRF-TOKEN, X-Socket-Id"
}
} And the Echo instantiation piece looks like the following: window.Echo = new Echo({
broadcaster: 'socket.io',
host: window.location.hostname + ':6001',
auth: {
headers: {
Authorization: 'Bearer 123sdfg1sdf1g321sdf2fg13ds2ff1g3'
}
}
}); Works with, or without, the Any help appreciated!! |
Finally got to the bottom of this!! After cloning and debugging this repo, I figured out it's actually To fix, I simply update the Echo instantiation to include the window.Echo = new Echo({
broadcaster: 'socket.io',
host: window.location.hostname + ':6001',
transports: ['websocket', 'polling', 'flashsocket'] // Fix CORS error!
}); No more CORS errors! 🎉 |
Hey there, this issue was opened a while ago. I'm going to close this issue, if this issue still exists, please open a new issue or open a Pull Request. |
To make real time an laravel app I want to use socket-io.
Client is an mobile App written by ionic framework and ran at
192.168.1.7:8100
.To configure and run socket-io Server I installed
[laravel-echo-server][1]
.This is larvel echo server configuration file to run socket io server :
First I run redis server with this command :
Then used this command to run soketio server :
result is like this :
And this is Echo laravel js :
But When I run main App in Chrome browser got below error in console :
I tried many solution to solve this problem like This Answer but problem is continued.
The text was updated successfully, but these errors were encountered: