Skip to content
This repository was archived by the owner on Feb 28, 2025. It is now read-only.

Commit 2518882

Browse files
author
Dimitri Pfaffenrodt
committed
Add default cors settings
1 parent 73c4eb8 commit 2518882

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

.github/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1010

1111
### Added
1212
- replace env `authHost` in config.json with LARAVEL_ECHO_AUTH_HOST
13+
- add default cors settings
14+
- replace env allowOrigin in config.json with LARAVEL_ECHO_ALLOW_ORIGIN
1315

1416
### Changed
1517
- Nothing

bin/docker-entrypoint

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ if [[ "$1" == 'start' ]] || [[ "$1" == 'client:add' ]] || [[ "$1" == 'client:rem
2323
cp /usr/local/src/laravel-echo-server.json /app/laravel-echo-server.json
2424
# Replace with environment variables
2525
sed -i "s|LARAVEL_ECHO_AUTH_HOST|${LARAVEL_ECHO_AUTH_HOST:-${LARAVEL_ECHO_SERVER_HOST:-localhost}}|i" /app/laravel-echo-server.json
26+
sed -i "s|LARAVEL_ECHO_ALLOW_ORIGIN|${LARAVEL_ECHO_ALLOW_ORIGIN:-${LARAVEL_ECHO_AUTH_HOST:-${LARAVEL_ECHO_SERVER_HOST:-localhost}}}|i" /app/laravel-echo-server.json
2627
sed -i "s|LARAVEL_ECHO_SERVER_DB|${LARAVEL_ECHO_SERVER_DB:-redis}|i" /app/laravel-echo-server.json
2728
sed -i "s|REDIS_HOST|${REDIS_HOST:-redis}|i" /app/laravel-echo-server.json
2829
sed -i "s|REDIS_PORT|${REDIS_PORT:-6379}|i" /app/laravel-echo-server.json

src/laravel-echo-server.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
{
2-
"apiOriginAllow": {},
2+
"apiOriginAllow":{
3+
"allowCors" : true,
4+
"allowOrigin" : "LARAVEL_ECHO_ALLOW_ORIGIN",
5+
"allowMethods" : "GET, POST",
6+
"allowHeaders" : "Origin, Content-Type, X-Auth-Token, X-Requested-With, Accept, Authorization, X-CSRF-TOKEN, X-Socket-Id"
7+
},
38
"authEndpoint": "/broadcasting/auth",
49
"authHost": "LARAVEL_ECHO_AUTH_HOST",
510
"clients": [],

0 commit comments

Comments
 (0)