I’m running Laravel with Octane with frankenPHP. It works fine but does not show images. I found that url() function in my views returns http://localhost:8002 which is docker address. I expect url() to return my domain name for example: http://example.com
In my docker-compose.yaml I have:
version: "3.9"
services:
app:
image: "my_image:latest"
entrypoint: php artisan octane:frankenphp
restart: unless-stopped
hostname: example.com
ports:
- "8002:8000"
My .env file:
APP_NAME=Laravel
APP_ENV=prod
APP_KEY=base64:api_key
APP_DEBUG=false
APP_URL=http://example.com
Does anyone know how to fix that?
2
Answers
The problem was that I hadn't set X-Forwarded-For in my NGINX. Now it works.
You have to set
APP_URL
in your .env fileChange
APP_URL=http://localhost
to thisAPP_URL=http://example.com