Search code examples
nginxproxywgethttp-status-code-503

wget error 503 while chrome works


I am trying to create a cron job to access a particular URL to do some maintenance stuff. While accessing the URL remotely from Chrome works fine (returns 200 OK), accessing it locally on the server with wget gets me "ERROR 503: Service Unavailable."

root@domain:/home/admin/web/domain.com/public_html/# wget http://www.domain.com/index.php?route=module/marketplace&action=run_queue
[1] 30283
root@domain:/home/admin/web/domain.com/public_html/# --2016-09-06 16:02:42--  http://www.domain.com/index.php?route=module/marketplace
Resolving www.domain.com (www.domain.com)... 46.10.20.30
Connecting to www.domain.com (www.domain.com)|46.10.20.30|:80... connected.
HTTP request sent, awaiting response... 503 Service Unavailable
2016-09-06 16:02:42 ERROR 503: Service Unavailable.

I am using Apache/2.4.7 (Ubuntu) + Nginx for serving static files.

Headers sent by Chrome

GET /index.php?route=module/marketplace&action=run_queue HTTP/1.1
Host: www.domain.com
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
DNT: 1
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-US,en;q=0.8,ro;q=0.6
Cookie: cookieconsent_dismissed=yes; __tawkuuid=e::domain.com::qsV03tUWg5avl3mTmLetAJpcbS+TGvpb7L33ER0ooHvJ0wsAPilIfGadi5f::2; Tawk_55ec3df37d21121ad0a5a=vs16.tawk.to:443::0; currency=USD; __atuvc=10%7C34; PHPSESSID=foru997tgbo437je6djtd3c2; language=ro; _ga=GA1.2.13206174.14484999; TawkConnectionTime=0; language=ro; currency=RON

Headers received in Chrome

HTTP/1.1 200 OK
Server: nginx
Date: Tue, 06 Sep 2016 13:22:23 GMT
Content-Type: text/html
Content-Length: 0
Connection: keep-alive
Keep-Alive: timeout=10
X-Powered-By: PHP/5.5.9-1ubuntu4.19
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache

What might be the problem here?


Solution

  • It was the comment of Margaret Bloom below my question which solved my problem. It was in fact an authentication problem and once I had the website correctly configured to be publicly accessible, wget started working normally.

    It was initially working in Chrome because I was authenticated there.

    Thanks.