Skip to content

Comments

Move cache enablement to framework config#293

Open
gothick wants to merge 1 commit intomainfrom
Fix/KernelConfig
Open

Move cache enablement to framework config#293
gothick wants to merge 1 commit intomainfrom
Fix/KernelConfig

Conversation

@gothick
Copy link
Owner

@gothick gothick commented Feb 17, 2026

At the moment, our reverse proxy-style caching is hardcoded in the index.php. It think we're better off putting this in the Framework config.

@gothick gothick requested a review from Copilot February 17, 2026 18:14
@sonarqubecloud
Copy link

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Moves reverse-proxy HTTP caching enablement out of public/index.php and into Symfony framework configuration, and adds config typing support for the staging environment.

Changes:

  • Remove environment-based CacheKernel wrapping from the front controller.
  • Enable/configure framework.http_cache via framework.yaml with prod/staging blocks.
  • Extend config/reference.php psalm array-shapes to include when@staging.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
public/index.php Removes runtime cache-kernel wrapping and returns the base Kernel directly.
config/reference.php Adds when@staging to psalm config and routes array-shapes.
config/packages/framework.yaml Enables http_cache and adds when@prod/when@staging framework blocks.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

}

return $kernel;
return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing the CacheKernel wrapping here means the app will no longer run behind Symfony's HttpCache reverse-proxy kernel in prod/staging. The framework.http_cache setting configures HttpCache options/services, but it doesn't instantiate App\CacheKernel by itself; you still need to wrap the kernel (or enable HttpCache via Symfony Runtime options) to actually get reverse-proxy caching.

Suggested change
return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);
$kernel = new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);
if ('prod' === $kernel->getEnvironment()) {
return new CacheKernel($kernel);
}
return $kernel;

Copilot uses AI. Check for mistakes.
Comment on lines +40 to +54
http_cache: true

when@test:
framework:
test: true
session:
storage_factory_id: session.storage.factory.mock_file

when@prod:
framework:
http_cache: true

when@staging:
framework:
http_cache: true
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

framework.http_cache: true is currently enabled globally (so it applies in dev/test too) and then duplicated again under when@prod/when@staging. If the intent is to enable reverse-proxy caching only for prod/staging (as the old index.php logic did), remove the global http_cache: true and keep it only in the relevant when@... blocks (or explicitly disable it in when@dev/when@test).

Copilot uses AI. Check for mistakes.
Comment on lines +40 to +41
http_cache: true

Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment above http_method_override says staging/prod also call enableHttpMethodParameterOverride() in index.php, but this PR removes that reverse-proxy creation. Please update/remove that comment so the configuration documentation matches the actual bootstrapping approach.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant