SSL-enabling virtual hosts

I'm writing an HTTP server application that will proxy several other servers, meaning that when a request comes in, my server will simply shuttle packets back and forth between the client and the real destination. It can do that because the HTTP HOST: header contains the original request, and the URL will tell us where the real host is.

When I want to SSL-enable this system, I run into a problem: The HTTP headers are not available until after the SSL handshake which can't be done without a valid certificate (which I don't have because onl the real target server has it). Classic chicken and egg problem.

This will be fixable in the future with Server Name Indication, a part of RFC 3546 which will allow the original URL request to be put into the ClientHello message, hence allowing my virtual server to determine the final destination without a full handshake.

My question is has anyone coded up anything related to this? Conceptually, it is straight forward - look at the request and open a socket to the destination server and simply relay the packets. In practice, I'm not really sure where to start. Any ideas?

Sander Smith

[1170 byte] By [smithsaa] at [2007-10-2 10:58:53]
# 1
Can this be done using the http connect method of rfc2817?
ghstarka at 2007-7-13 3:26:50 > top of Java-index,Security,Java Secure Socket Extension (JSSE)...
# 2

> Can this be done using the http connect method of

> rfc2817?

Good idea, but not going to work for me. The server I'm building is a reverse proxy which needs to be transparent to the clients. The method you're suggesting is fine if you can configure the clients to be aware of the proxy - not an option for my application.

Another way to do this is to allow each virtual host to have its own IP address, play games at the DNS server, and then demultiplex the requests based on that. This works fine except it won't scale to the case where there are very many virtual hosts since you'd need the same number of IP address (not an option for me).

The real long-term solution is the extended ClientHello message. The major browsers have plannd support for this, and I just want to write something as proof of concept.

Can anyone help?

Sander

smithsaa at 2007-7-13 3:26:50 > top of Java-index,Security,Java Secure Socket Extension (JSSE)...