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

  • SEARCH
  • Home
  • 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 8279717
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T09:25:03+00:00 2026-06-08T09:25:03+00:00

I have recently set up a website which uses geographic DNS to resolve the

  • 0

I have recently set up a website which uses geographic DNS to resolve the DNS to two different IP’s depending on your location.

However, this means to monitor the websites, I need to make sure the site is available in both geographical locations. To do this I wrote a small program in .net to continually try and HttpWebRequest to get a small html file on the website once using the local internet settings and once using a proxy based in the region which will resolve the name to the second IP address.

This works fine on my laptop at home, however in the office, to connect to the internet on almost all machines you will need to go via a proxy, which means the proxy I set earlier no longer works.

What I need to be able to do is send the request through the office proxy, then through the proxy in the remote country and finally to the website.

Let me know if this is not clear enough!

  • 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-06-08T09:25:06+00:00Added an answer on June 8, 2026 at 9:25 am

    First you need to ensure that both proxies are HTTPS and they both support CONNECT method, i.e. “proxy chaining”. Design of usual HTTP protocol doesn’t provide support for “proxy chaining”.
    The idea is to establish 2 CONNECT tunnels, one inside another.
    The algorithm is the following:

    1. Connect to the 1st proxy via TCP
    2. Request CONNECT tunnel to 2nd proxy
    3. Once tunnel is created, request tunnel to target host
    4. Send request. Request will go to target host through proxy #1 and proxy #2.
      Below is a sample code which I have tested on my box:

      string host = "encrypted.google.com";
      string proxy2 = "213.240.237.149";//host;
      int proxyPort2 = 3128;//443;
      string proxy = "180.183.236.63";//host;
      int proxyPort = 3128;//443;
      
      byte[] buffer = new byte[2048];
      int bytes;
      
      // Connect to the 1st proxy
      TcpClient client = new TcpClient(proxy, proxyPort);
      NetworkStream stream = client.GetStream();
      
      // Establish tunnel to 2nd proxy
      byte[] tunnelRequest = Encoding.UTF8.GetBytes(String.Format("CONNECT {0}:{1}  HTTP/1.1\r\nHost:{0}\r\n\r\n", proxy2, proxyPort2));
      stream.Write(tunnelRequest, 0, tunnelRequest.Length);
      stream.Flush();
      
      // Read response to CONNECT request
      // There should be loop that reads multiple packets
      bytes = stream.Read(buffer, 0, buffer.Length);
      Console.Write(Encoding.UTF8.GetString(buffer, 0, bytes));
      
      // Establish tunnel to target host
      tunnelRequest = Encoding.UTF8.GetBytes(String.Format("CONNECT {0}:443  HTTP/1.1\r\nHost:{0}\r\n\r\n", host));
      stream.Write(tunnelRequest, 0, tunnelRequest.Length);
      stream.Flush();
      
      // Read response to CONNECT request
      // There should be loop that reads multiple packets
      bytes = stream.Read(buffer, 0, buffer.Length);
      Console.Write(Encoding.UTF8.GetString(buffer, 0, bytes));
      
      // Wrap into SSL stream
      SslStream sslStream2 = new SslStream(stream);
      sslStream2.AuthenticateAsClient(host);
      
      // Send request
      byte[] request = Encoding.UTF8.GetBytes(String.Format("GET https://{0}/  HTTP/1.1\r\nHost: {0}\r\n\r\n", host));
      sslStream2.Write(request, 0, request.Length);
      sslStream2.Flush();
      
      // Read response
      do
      {
          bytes = sslStream2.Read(buffer, 0, buffer.Length);
          Console.Write(Encoding.UTF8.GetString(buffer, 0, bytes));
      } while (bytes != 0);
      
      client.Close();
      Console.ReadKey();
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a rails environment which I set-up with macports. I recently updated macports
We have multiple ftp accounts for each website and recently have set up the
I have recently set up a website using MODx Revolution. I am attempting to
I have an ASP.NET v2 website which uses NHibernate for ORM. My current architecture
I recently discovered that when you have a page set to session readonly and
I recently started using NERDTree with vim, and have set it to automatically open
I've recently been using this set up on a website... http://jsfiddle.net/mnRNE/ CSS body {
I have recently done some website work for a charity. The site I have
I recently redesigned my college newspaper's website and have been doing everything I can
I have a website written in-house, using a 3rd party login mechanism. Recently we've

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.