Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Profiler doesn't show the response modified by AbstractSessionListener. #36846

Open
marcw opened this issue May 17, 2020 · 3 comments
Open

Profiler doesn't show the response modified by AbstractSessionListener. #36846

marcw opened this issue May 17, 2020 · 3 comments

Comments

@marcw
Copy link
Contributor

marcw commented May 17, 2020

Symfony version(s) affected: 5.0 & 4.4

Description

When the AbstractSessionListener modifies the Response Cache-Control headers automatically, it is not reflected in the Symfony Profiler.

Example controller:

    /**
     * @Route("/bug", name="demo")
     */
    public function index()
    {
        $response = new BinaryFileResponse(__FILE__, 200);

        $response->setPublic();
        $response->headers->addCacheControlDirective("immutable");
        $response->setMaxAge(3600);

        return $response;
    }

Resulting curl command on the controller:

$ curl -I https://127.0.0.1:8000/bug
HTTP/2 200
accept-ranges: bytes
cache-control: immutable, max-age=0, must-revalidate, private
content-type: text/x-php;charset=UTF-8
date: Sun, 17 May 2020 12:07:36 GMT
expires: Sun, 17 May 2020 12:07:36 GMT
last-modified: Sun, 17 May 2020 11:54:28 GMT
x-debug-token: c914a6
x-debug-token-link: https://127.0.0.1:8000/_profiler/c914a6
x-powered-by: PHP/7.4.5
x-robots-tag: noindex
content-length: 571

What is shown in the Profiler Response tab:
Screenshot 2020-05-17 at 14 09 14

How to reproduce

A reproducer is available here: https://github.com/marcw/reproducer-symfony-bug-http-response-profiler.

Please:

  • Run symfony serve
  • Run curl -I https://localhost:8000/bug
  • Open https://127.0.0.1:8000/_profiler/latest?limit=10 and go to the Response tab.

Possible Solution

A possible solution was PR #36789 but it is in the process of being reverted (See #36838) as it caused the Debug toolbar to disappear (See #36836).

Another solution would be to ease the debugging when the Response is modified. A warning in the logs would be helpful as well.

@carsonbot
Copy link

Hey, thanks for your report!
There has not been a lot of activity here for a while. Is this bug still relevant? Have you managed to find a workaround?

@derrabus
Copy link
Member

derrabus commented Apr 3, 2021

Let's keep this bug open, @carsonbot.

@carsonbot carsonbot removed the Stalled label Apr 3, 2021
@carsonbot
Copy link

Hey, thanks for your report!
There has not been a lot of activity here for a while. Is this bug still relevant? Have you managed to find a workaround?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants