Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6239671
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T11:25:53+00:00 2026-05-24T11:25:53+00:00

Im writing an http client to read from facebook using node.js and using the

  • 0

Im writing an http client to read from facebook using node.js and using the following code:

var http = require('http');

var options = {
  host: 'www.fb.com',
  path: '/',
  "user-agent": "node.js"
};

http.get(options, function(res) {
  console.log("Got response: " + res.statusCode);
  console.log(res.headers);
}).on('error', function(e) {
console.log("Got error: " + e.message);
});

In my browser, this returns a 301 redirect with the location of http://www.facebook.com, however in node.js I get a 302 response with a location of http://www.fb.com/common/browser.php.
I tried it with the latest version of node and it still throws this error.

I’d really appreciate some help with this,
Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T11:25:55+00:00Added an answer on May 24, 2026 at 11:25 am

    This dosent seem to be a bug of node.js I made a request to fb.com in curl and I got the same redirect.

    It probably makes that decision based on the user agent… maybe you can use the user agent of a browser 😀

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We are writing a HTTP based desktop application whose client runs from outside our
I'm writing a little Java client side app which uploads things using http streams
I'm writing an automation script with autoit: http://www.autoitscript.com/autoit3/index.shtml . In the process I need
I am writing some documentation and I have a little vocabulary problem: http://www.example.com/en/public/img/logo.gif is
I'm writing some browser side dynamic functionality and using HTTP Basic Auth to protect
I'm writing a url rewrite in django that when a person goes to http://mysite.com/urlchecker/http://www.google.com
I have a simple service that does approximately the following: An HTTP client connects
I am writing a web application using Codeigniter for a client and am using
I am writing client software that initiates a HTTP request with a large blob
I'm using a Java program to POST some XML data from a remote client

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.