I just fixed a problem but do not exactly understand why the solution works.
Setting:
- Windows 10
- Laravel 7.0
- PHP built in server (via
php artisan serve --port=80
) - Hosts file with entry
127.0.0.1 something.local
Problem:
Making a web page request to http://something.local in the browser took very long to load. Upon inspection in chrome dev tools I found out that it is not the server but the actual content download.
Although we are talking about ~7MB to download a download time of >10sec seemed insane to me.
Solution that I do not really understand :
Changing the hosts file entry to 127.0.0.1 something.habibi
fixed it for me.
Why does it take so long to download a web page if I use an entry ending in .local in my hosts file?
Thoughts:
.local is not a top level domain but a special-use domain. It seems to me that because of this the request to a url ending in .local might not stay on my machine but goes through my wlan/router somehow and thus takes longer.
But this is as far as I got. It would be nice if someone can make better sense of this behaviour.
Advertisement
Answer
Unfortunately I can not make the special behavior of a special-use domain any clearer to you as this is not my forte at all.
But:
Do you – by any chance – have a chrome extension called “Xdebug helper” installed?
If this chrome extension would be the actual cause of your problem than your solution makes sense: changing the url in the browser has the effect that the Xdebug helper extension does not debug this new url you just put in.
Therefore you might think that your problem is caused by the different ending (switching from “.local” to “.habibi”) but in reality it is just this chrome extension that gets disabled for the new url.
So long story short: your question is not reproducible and thus can’t really be answered.
By the way: Others seem to have the same problem.