Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## [Unreleased](https://github.com/laravel/octane/compare/v2.12.3...2.x)

### Added

* FrankenPHP: Add env option `OCTANE_FRANKENPHP_DISABLE_ACCESS_LOGS` to disable Caddy access logs

## [v2.12.3](https://github.com/laravel/octane/compare/v2.12.2...v2.12.3) - 2025-09-23

* Replace Octane::writeError with die statements by [@7amoood](https://github.com/7amoood) in https://github.com/laravel/octane/pull/1057
Expand Down
20 changes: 20 additions & 0 deletions src/Commands/StartFrankenPhpCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,25 @@ public function handle(ServerProcessInspector $inspector, ServerStateFile $serve
$serverName = $https
? "https://$host:$port"
: "http://:$port";
// Allow disabling Caddy access logs via environment variable (default: enabled)
$disableAccessLogs = env('OCTANE_FRANKENPHP_DISABLE_ACCESS_LOGS', false);
$logBlock = $disableAccessLogs
? '# Access logs disabled via env'
: <<<'LOG'
log {
level {$CADDY_SERVER_LOG_LEVEL}

# Redact the authorization query parameter that can be set by Mercure...
format filter {
wrap {$CADDY_SERVER_LOGGER}
fields {
uri query {
replace authorization REDACTED
}
}
}
}
LOG;

$process = tap(new Process([
$frankenphpBinary,
Expand All @@ -101,6 +120,7 @@ public function handle(ServerProcessInspector $inspector, ServerStateFile $serve
'CADDY_SERVER_ADMIN_HOST' => $this->option('admin-host'),
'CADDY_SERVER_LOG_LEVEL' => $this->option('log-level') ?: (app()->environment('local') ? 'INFO' : 'WARN'),
'CADDY_SERVER_LOGGER' => 'json',
'CADDY_SERVER_LOG_BLOCK' => $logBlock,
'CADDY_SERVER_SERVER_NAME' => $serverName,
'CADDY_SERVER_WORKER_COUNT' => $this->workerCount() ?: '',
'CADDY_SERVER_WORKER_DIRECTIVE' => $this->workerCount() ? "num {$this->workerCount()}" : '',
Expand Down
14 changes: 1 addition & 13 deletions src/Commands/stubs/Caddyfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,7 @@
{$CADDY_EXTRA_CONFIG}

{$CADDY_SERVER_SERVER_NAME} {
log {
level {$CADDY_SERVER_LOG_LEVEL}

# Redact the authorization query parameter that can be set by Mercure...
format filter {
wrap {$CADDY_SERVER_LOGGER}
fields {
uri query {
replace authorization REDACTED
}
}
}
}
{$CADDY_SERVER_LOG_BLOCK}

route {
root * "{$APP_PUBLIC_PATH}"
Expand Down