Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Session drop security token on BinaryFileResponse

In my application when the user access a page that return a BinaryFileResponse he gets disconnected.

When I put a die before the return I can dump the session and the user and reload without any issue, BUT everytime the app serve a file the user get disconnected on the next request ... Its driving me nuts atm as I just made a composer update before the issue appears... :(

I tried to close the session handle. I tried every other route ... this is the only one dropping the security token

<?php 

        // [...] 
        $response = new BinaryFileResponse($f->filePath(),200,[],false);
        $disposition = HeaderUtils::makeDisposition(
            $fileManager->getDisposition($f),
            $f->getFilename()
        );
        if($f->getEtag() !== null){
            $response->setEtag($f->getEtag());
        }

        $response->headers->set('Content-Disposition', $disposition);
        $response->headers->set('Content-Type', $f->getContentType());

        return $response;

It just drop the security token on the next request... is this something related to the streamed response ?

EDIT : it only happen on Chrome (latest macOS)

like image 563
Omar0kyll Avatar asked Jul 28 '26 10:07

Omar0kyll


1 Answers

It was a bug in the Google Chrome release (Version 75.0.3770.142) ;)

like image 155
hunomina Avatar answered Jul 31 '26 00:07

hunomina