Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. System Admin
  4. Http connection through Proxy

Http connection through Proxy

Scheduled Pinned Locked Moved System Admin
questionsysadmin
4 Posts 3 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Sam1979
    wrote on last edited by
    #1

    How can I connect a client application running behind a proxy to a web server? The connection cannot be a direct TCP to the server as the proxy is in between. I can have a Http connection , the way a browser works. But how do I achieve it. Any suggestions??

    R 1 Reply Last reply
    0
    • S Sam1979

      How can I connect a client application running behind a proxy to a web server? The connection cannot be a direct TCP to the server as the proxy is in between. I can have a Http connection , the way a browser works. But how do I achieve it. Any suggestions??

      R Offline
      R Offline
      Robert Little
      wrote on last edited by
      #2

      Your questions is a bit general to give you a specific answer. Let me lay out some examples. Let's say you have an client application that will be using the HTTP protocol to contact a server. If you want the client app to make all transactions via a proxy you would need to configure the client app to connect to the proxy itself. If you are using the HTTP protocol, then you would tell the proxy what destination server you want your request forwarded to and the proxy would then interpret that request and perform it, and return the results to you. How you make the connection via a proxy really depends on the type of protocol. Take the SMTP protocol for example. This protocol was not originally designed to be a proxied protocol. However, that doesn't mean you can't proxy it. In this case you would configure your mail client to connect to the proxy when sending mail. The proxy would then be configure to connect to the real server. In this scenario, the client would not know that all of it's requests are being forwarded to the real server. Hope that helps.

      A 1 Reply Last reply
      0
      • R Robert Little

        Your questions is a bit general to give you a specific answer. Let me lay out some examples. Let's say you have an client application that will be using the HTTP protocol to contact a server. If you want the client app to make all transactions via a proxy you would need to configure the client app to connect to the proxy itself. If you are using the HTTP protocol, then you would tell the proxy what destination server you want your request forwarded to and the proxy would then interpret that request and perform it, and return the results to you. How you make the connection via a proxy really depends on the type of protocol. Take the SMTP protocol for example. This protocol was not originally designed to be a proxied protocol. However, that doesn't mean you can't proxy it. In this case you would configure your mail client to connect to the proxy when sending mail. The proxy would then be configure to connect to the real server. In this scenario, the client would not know that all of it's requests are being forwarded to the real server. Hope that helps.

        A Offline
        A Offline
        Anonymous
        wrote on last edited by
        #3

        What I have read about Http CONNECT is that it is used to establish a secure connection to the server.Does that mean that I can connect only to port 443 of the Listner i.e. server? Can I connect to the port 80 of the server i.e specify the ip address:80 in the CONNECT method

        R 1 Reply Last reply
        0
        • A Anonymous

          What I have read about Http CONNECT is that it is used to establish a secure connection to the server.Does that mean that I can connect only to port 443 of the Listner i.e. server? Can I connect to the port 80 of the server i.e specify the ip address:80 in the CONNECT method

          R Offline
          R Offline
          Robert Little
          wrote on last edited by
          #4

          There is nothing special about the port. It is just a commonly chosen port of 443 for HTTPS and 80 for HTTP. If you want to make a non-secure connection then you make your connection and don't negotiate an SSL session. Of course the server you connect to must be expecting a non secure connection, which most do. Let's say you want to connect to codeproject from your browser. If you were to connect directly from your application, it would open a TCP connection via port 80 and send something similar to the following. GET / HTTP/1.1 Accept: */* Accept-Language: en-us User-Agent: Your application name here Host: www.codeproject.com What will be returned will be the contents of the page requested. You can test this using telnet. Open a telnet session to your own server on port 80 and type the above text. End the text with two carriage returns to get the results. Now if you wanted to do the same request via a proxy you would do something like this. GET http://www.codeproject.com/ HTTP/1.1 Accept: */* Accept-Language: en-us User-Agent: Your application name here Host: www.codeproject.com There is very little difference. In this case you supply the host and protocol portion of the URL instead of just the path. This is because the proxy needs to know the name of the host you want to connect to. Instead of connecting to port 80 on codeproject you would connect to port 80 on your proxy server. Of course your proxy could use any port you wish. Port 80 is the standard, but it could easily be 8080 or some other port of you chosing. If your proxy understands other protocols such as https, ftp, gopher, or a custom protocol then you could use those by simply modifying the URL passed.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups