Curl and Wget returns different response code

curlredirectwget

I am trying to wget a link, this wget works fine on my local machine but it doesn't do so on the server.
i tried to check the response header and i got the following on my local laptop


curl -I http://en.cihan.com.tr/rss?user=albawaba\&type=12
HTTP/1.0 200 OK
Server: Apache-Coyote/1.1
X-Powered-By: Servlet 2.4; JBoss-4.2.2.GA (build: SVNTag=JBoss_4_2_2_GA date=200710221139)/Tomcat-5.5
Set-Cookie: JSESSIONID=E65E0CC7CF956F45962FD8571F3AB02A; Path=/
Content-Type: application/xml;charset=UTF-8
Content-Length: 80043
Date: Thu, 29 Mar 2012 12:19:26 GMT
Set-Cookie: NSC_fo-sv-bs.djibo.dpn.us=ffffffff092a094245525d5f4f58455e445a4a4229a0;expires=Thu, 29-Mar-2012 12:20:51 GMT;path=/
X-Cache: MISS from Bilal
Connection: close

while on the server i got

curl -I http://en.cihan.com.tr/rss?user=albawaba\&type=12
HTTP/1.1 302 Moved Temporarily
Server: Apache-Coyote/1.1
X-Powered-By: Servlet 2.4; JBoss-4.2.2.GA (build: SVNTag=JBoss_4_2_2_GA date=200710221139)/Tomcat-5.5
Set-Cookie: JSESSIONID=CCB29F3789ED06C505436F1289A122D4; Path=/
Location: http://en.cihan.com.tr/rssAlert
Content-Type: text/xml;charset=UTF-8
Content-Length: 0
Date: Thu, 29 Mar 2012 12:11:33 GMT
Set-Cookie: NSC_fo-sv-bs.djibo.dpn.us=ffffffff092a094245525d5f4f58455e445a4a4229a0;expires=Thu, 29-Mar-2012 12:12:58 GMT;path=/

Any idea of why i am getting response 200 on my laptop and 302 on the server for the same link!!?

Best Answer

The page you are redirected to says "You are not authorized to access this page!".

This is little more than a guess but I think that they are doing IP dependent content restriction and your laptop is in an allowed location while your server is not.

I tried the same URL myself and got the 302 redirect from two different places in the UK and one in France. I got a connection timeout from an Amazon EC2 server.

Oddly, they are using a 302 redirect to the error page rather than simply serving the error page with an appropriate HTTP response code, such as 403 or 401.

Related Topic