Reputation: 31
I can open up http://delta.com fine. However when I do a wget on the same url, it returns HTTP 500, Server Error. Can somebody explain the reason for that discrepency
Thanks, John
Upvotes: 2
Views: 8609
Reputation: 13592
If the site works in the browser, it is possibly rejecting wget's user agent or trying to do some work based on the language.
To fix it, you can include --header
and --user-agent
.
In your browser, let's say that you are using Chrome, go to Network and then go to the location of that URL. Then, check the Request Headers and use in the command what you have in Accept-Language
and User-Agent
. For instance:
wget --header='Accept-Language: en-US,en;q=0.9,pt-PT;q=0.8,pt;q=0.7,de;q=0.6,fr;q=0.5,es;q=0.4,it;q=0.3,gl;q=0.2,hu;q=0.1' --user-agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36" -c "http://..." -w 1
Upvotes: 2
Reputation: 601
The website seems to be trying to do some work based on the language, it works fine with an Accept-Language
header.
wget --header='Accept-Language: en-us,en;q=0.5' http://delta.com
Upvotes: 3