Http connection through Proxy
-
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??
-
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??
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.
-
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.
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
-
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
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.