I have a route with a parameter, e.g. /r/{app_id}
. The controller extends ContainerInjectionInterface
. The method either returns a render array or a new TrustedRedirectResponse
.
I believe I have a caching problem because subsequent visits to the page will not update even with changing {app_id}
. If I visit from another browser I get the correct response one time.
My controller is, basically, this:
if (!$a) {
return ['#markup' => 'no'];
}
return new TrustedRedirectResponse($url);
I have tried to disable cache in several ways, to no avail:
addCacheableDependency
- putting
#cache => ['max-age' => 0]
on the render array \Drupal::service('page_cache_kill_switch')->trigger();
- using
$response = new Response()
and$response->setCache(['max_age' => 0])
and then, from within the conditional, using$response->setContent('blah')
Not having luck with any of the above.