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 7536901
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T06:42:06+00:00 2026-05-30T06:42:06+00:00

I want to be able to do a http.get request through node within my

  • 0

I want to be able to do a http.get request through node within my own vpn, but it seems likes the function is passing the website to a dns instead of look in my vpn. This following code works with google as the host.

http = require('http');
var host = "www.google.com";
var options = {host:host, port:80, path:'/'}

http.get( options, function( res ){
    res.setEncoding('utf8');
    res.on( 'data', function( chunk ){
          console.log( chunk );
    });
});

but when I change host to a_site_on_my_vpn.com it throws a Domain name not found error, but when i type a_site_on_my_vpn.com on firefox I am able to load the page. I guess one way I can fix this is to find out the host name’s ip but is there an easier way? 😀

I resolve my own answer, but to answer the question in the follow up, the answer is yes here is a snippet that shows that, by doing an DNS ip lookup then going to google by IP.

var dns = require('dns');
var http = require('http');

dns.resolve4('www.google.com', function (err, addresses) {
    if (err) throw err;

    console.log('addresses: ' + JSON.stringify(addresses));

    var options = {
    host: addresses[0]
    }

    http.get(options, function(res){
      console.log("Sending http request to google with options", options);
      var htmlsize = 0;
      res.on('data', function( chunk ){
          htmlsize+=chunk.length;
      });
      res.on('end', function(){
          console.log( "got html of lenght", htmlsize );
      });
    });
});

And this is the output

addresses: ["74.125.224.82","74.125.224.81","74.125.224.84","74.125.224.80","74.125.224.83"]
Sending http request to google with options { host: '74.125.224.82' }
got html of lenght 33431
  • 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-30T06:42:08+00:00Added an answer on May 30, 2026 at 6:42 am

    http does resolve addresses correctly that are in a VPN, but I just had a small typo.

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

Sidebar

Related Questions

I want to be able to make an HTTP call updating some select boxes
I have an web address: http://www.example.com/org/companyA I want to be able to pass CompanyA
I want to change first line of the HTTP header of my request, modifying
I want to be able to call a URL be either a standard HTTP
<script src=http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js type=text/javascript></script> <script> $.get(http://example.com/, function(data) { alert(data); }); </script> it does an OPTIONS
I want to be able to get a list of issues given a: Project
Does it send an HTTP GET request for the specified file? I'm trying to
I want to connect to GitHub at work and need to get through the
I am relatively new to this, but I'm working through things. I want to
I'm using LaTeX and BibTeX for an article, and I want to able to

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.