Support the ongoing development of Laravel.io →
posted 3 years ago

Hi to all In a controller file of my laravel application in an INTRANET context I've the following code to permit to download a file:

$path = trim($path_file); $filename = basename($path); $headers = [ 'Content-Type: application/pdf', 'Content-Disposition: attachment; filename="'.trim($filename).'"', ]; $resp = \Response::download($path, trim($filename), $headers); return $resp;

The script works BUT:

  1. If I am connected to Internet the response takes some ms (instantly)
  2. If I am NOT connected to Internet the response takes 20-30 seconds. Why this?
  • I've already set on my apache the ServerName (ServerName 127.0.0.1:8095)
  • I've setted in my hosts file the string "127.0.0.1 localhost" The problem persist. Thank you very much

Matteo

Last updated 3 years ago.
0
moderator

Is the server on your localhost where you try to cal it?

If the response time is different depending on your external connection while the request is local you most of the time need to search it in your dns/network settings.

0

I've updated the hosts file but the problem still persist.

0

Sign in to participate in this thread!

PHPverse

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.