I think the broadcast auth URL will need to be portal.app.dev as per your caddy config
Mar 26, 2019
11
Level 1
Laravel Echo Server - Client can not be authenticated, got HTTP status 404
I am using docker with caddy server
Laravel Version 5.6
laravel-echo-server.json
{
"authHost": "http://web",
"authEndpoint": "/broadcasting/auth",
"clients": [],
"database": "redis",
"databaseConfig": {
"redis": {
"host": "redis",
"password":"123456",
"options": {
"db": 1
}
},
"sqlite": {
"databasePath": "/database/laravel-echo-server.sqlite"
},
"publishPresence": true
},
"devMode": true,
"host": null,
"port": "6001",
"protocol": "http",
"sslCertPath": "",
"sslKeyPath": "",
"sslCertChainPath": "",
"sslPassphrase": "",
"apiOriginAllow": {
"allowCors": true,
"allowOrigin": "http://localhost",
"allowMethods": "GET, POST",
"allowHeaders": "Origin, Content-Type, X-Auth-Token, X-Requested-With, Accept, Authorization, X-CSRF-TOKEN, X-Socket-Id"
},
"subscribers":{
"http": false, "redis": true
}
}
404 Site web is not served on this interface
echo_1 |
echo_1 | Client can not be authenticated, got HTTP status 404
echo_1 | [6:53:36 PM] - Sending auth request to: http://web/broadcasting/auth
echo_1 |
echo_1 | ? [6:53:36 PM] - 6k3LT_k995xxKupYAAAC could not be authenticated to private-App.User.1
echo_1 | 404 Site web is not served on this interface
echo_1 |
echo_1 | Client can not be authenticated, got HTTP status 404
Enabled broadcast service provider in config/app.php
caddy config
http://api.app.dev, http://portal.app.dev {
tls off
root /var/www/public
gzip
fastcgi / app:9000 php
rewrite {
to {path} {path}/ /index.php?{query}
}
}
docker-compose.yml
version: '3.5'
services:
app:
build: ./docker/php
depends_on:
- database
- mongodb
- cache
- queue
volumes:
- ./:/var/www/
- $HOME/.composer/:$HOME/.composer/
- ./docker/php/php-custom.ini:/usr/local/etc/php/php.ini
environment:
- "BEANSTALKD_HOST=queue"
- "QUEUE_DRIVER=beanstalkd"
env_file:
- .env
web:
image: abiosoft/caddy
container_name: caddy
volumes:
- ./docker/caddy/prod/Caddyfile:/etc/Caddyfile
- ./:/var/www/
- ./storage/certs:/root/.caddy/acme/acme-v02.api.letsencrypt.org/sites
ports:
- 80:80
- 443:443
depends_on:
- app
environment:
- ACME_AGREE=true
mongodb:
image: mongo:latest
container_name: mongodb
environment:
- "MONGO_INITDB_DATABASE=${MONGO_DATABASE}"
- "MONGO_INITDB_ROOT_USERNAME=${MONGO_USERNAME}"
- "MONGO_INITDB_ROOT_PASSWORD=${MONGO_PASSWORD}"
volumes:
- mongodb:/data/db
ports:
- 27017:27017
command: mongod --auth --storageEngine wiredTiger
env_file:
- .env
database:
image: mariadb:latest
volumes:
- mysqldata:/var/lib/mysql
environment:
- "MYSQL_ROOT_PASSWORD=${DB_ROOT_PASSWORD}"
- "MYSQL_DATABASE=${DB_DATABASE}"
- "MYSQL_USER=${DB_USERNAME}"
- "MYSQL_PASSWORD=${DB_PASSWORD}"
ports:
- 3306:3306
env_file:
- .env
#laravel cron
cron:
build: ./docker/crontab
#container_name: cron
volumes:
- ./:/var/www/
depends_on:
- app
environment:
- "BEANSTALKD_HOST=queue"
- "QUEUE_DRIVER=beanstalkd"
env_file:
- .env
#laravel worker
worker:
build: ./docker/worker
#container_name: worker
volumes:
- ./:/var/www/
depends_on:
- queue
- cache
- mongodb
- database
environment:
- "BEANSTALKD_HOST=queue"
- "QUEUE_DRIVER=beanstalkd"
env_file:
- .env
cache:
image: redis:4.0-alpine
command: redis-server --appendonly yes --requirepass "${REDIS_PASSWORD}"
ports:
- 6379:6379
env_file:
- .env
echo:
build: ./docker/echo-server
ports:
- '6001:6001'
depends_on:
- app
- web
links:
- web
- cache
volumes:
- ./docker/echo-server/prod/laravel-echo-server.json:/app/laravel-echo-server.json:ro
- ./storage/certs:/app/storage/certs:ro
queue:
image: schickling/beanstalkd
nodejs:
build: ./docker/nodejs
volumes:
- ./:/var/www/
volumes:
mysqldata:
mongodb:
networks:
default:
external:
name: caddy-proxy
I am not sure where i did wrong!
Level 1
@jamesmowatt below config is also working . It restricts with the container ip . Hope this will be a good solution
http://web:80 {
tls off
root /var/www/public
gzip
fastcgi / app:9000 php
rewrite {
to {path} {path}/ /index.php?{query}
}
}
Please or to participate in this conversation.
