Skip to content

Instantly share code, notes, and snippets.

@kristjan
Created September 28, 2011 23:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kristjan/1249597 to your computer and use it in GitHub Desktop.
Save kristjan/1249597 to your computer and use it in GitHub Desktop.
Facebook's funny redirect behavior
# Curling some Facebook users' IDs at http://fb.me will send you to their profile
$ curl fb.me/6 -D -
HTTP/1.1 302 Found
Location: http://www.facebook.com/6
Content-Type: text/html; charset=utf-8
X-FB-Server: 10.52.92.83
X-Cnection: close
Date: Wed, 28 Sep 2011 23:38:26 GMT
Content-Length: 0
# Others don't for some reason
$ curl fb.me/204381 -D -
HTTP/1.1 302 Found
Location: http://www.facebook.com
Content-Type: text/html; charset=utf-8
X-FB-Server: 10.52.68.61
X-Cnection: close
Date: Wed, 28 Sep 2011 23:37:33 GMT
Content-Length: 0
# Something invalid like 0 sends you home too
$ curl fb.me/0 -D -
HTTP/1.1 302 Found
Location: http://www.facebook.com
Content-Type: text/html; charset=utf-8
X-FB-Server: 10.54.71.24
X-Cnection: close
Date: Wed, 28 Sep 2011 23:36:33 GMT
Content-Length: 0
# But apparently ID 1 is Yahoo!
$ curl fb.me/1 -D -
HTTP/1.1 301 Moved Permanently
Location: http://www.yahoo.com
Content-Type: text/html; charset=utf-8
X-FB-Server: 10.52.59.69
X-Cnection: close
Date: Wed, 28 Sep 2011 23:35:54 GMT
Content-Length: 0
@gdeglin
Copy link

gdeglin commented Sep 28, 2011

Last one is probably left over from when they were testing out the url shortener feature of the domain..

GD-iMac:~ george$ curl fb.me/Dl9CyHL1 -D -
HTTP/1.1 301 Moved Permanently
Location: http://www.youtube.com/watch?v=V2tG1v0lSLQ
Content-Type: text/html; charset=utf-8
X-FB-Server: 10.54.82.42
X-Cnection: close
Date: Wed, 28 Sep 2011 23:52:27 GMT
Content-Length: 0

@kristjan
Copy link
Author

Aha, never realized they wanted a general tool out of it. How'd you find that particular ID?

@gdeglin
Copy link

gdeglin commented Oct 1, 2011

Facebook automatically shortens urls for some things. Text message notifications are one example iirc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment