Google Update Created Bug – This file should be served over HTTPS. This download has been blocked

Google Chrome started blocking downloads served via HTTP.

This update broke my download links and shows the console error below.

Mixed Content: The site at ‘https://www.sellmyiphonemiami.com/’ was
loaded over a secure connection, but the file at
‘https://www.sellmyiphonemiami.com/order/print-shipping-label/731’ was
redirected through an insecure connection. This file should be served
over HTTPS. This download has been blocked. See
https://blog.chromium.org/2020/02/protecting-users-from-insecure.html
for more details.

My pdf downloads are served over HTTPS but I still get this error.

Heres is my controller:

$filename = sprintf('FedExShippingLable-%s.pdf', $order->getshippingTrackingNumber());
    $fs = new Filesystem();
    $fs->dumpFile($filename, $order->getshippingDocument());
    // Generate response
    $response = new Response();
    // Set headers
    $response->headers->set('Cache-Control', 'private');
    $response->headers->set('Content-type', mime_content_type($filename));
    $response->headers->set('Content-Disposition', 'attachment; filename="' . basename($filename) . '";');
    $response->headers->set('Content-length', filesize($filename));
    // Send headers before outputting anything
    $response->sendHeaders();
    $response->setContent(file_get_contents($filename));
    $fs->remove($filename);
    return $response;

$10,000 to the first person who can solve.

Just kidding but I’ll be eternally grateful.

Thanks!

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *