userss-----ssl------>proxys------cleartext------>bunch of web server
That improves the performance cause:
- we are able to route sensitively connection to multiple web app server
- SSL accelerator/wrapper can manage much more SSL session than a web service like apache (at least twice more for my benchmark)
- We can cache content on the SSL accelerator server with a basic cache service (e.g squid)
- And much much more scalability
here my case:
- SSL accelerator/wrapper by pound (with or without ssl accelerator card)
- reverse proxy by squid
- php web app served by apache2 or lighttpd
How to tell the web app that the connection with the users are indeed encrypted but must stay unencrypted between the proxy and the web server.
Let's use header like X_FORWARDED_PROTO which would be either "http" or "https" and use it in our webapp PHP code as follow:...
if ( [webapp setting :: behind ssl accelerator] = true):NB: the first webapp setting condition is to avoid hackers to use this headers in their browser to fool the webapp in case there is no ssl wrapper. remove it if you don't care about security for that feature
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO'])) {
// apps is behind a ssl accelerator
$what__is_served_to_user = $_SERVER['HTTP_X_FORWARDED_PROTO'];
$what_webapp_must_serve = http
}
}
...
So now we tell your own ssl accelerator to set the headers properly. in case of pound :...
AddHeader "X-Forwarded-Proto: https"Voila
...
NB: Squid could be the SSL wrapper and the caching service together if it was possible to legally provide it with openssl compiled in. unfortunately the GPL and openssl license does not fit together and SQUID devs not ready to move to gnutls nor provide a license exception and my company don't want to enter in illegal position. However i packaged squid with openssl (like redhat do whatever it's not legal) and it works great as SSL wrapper as well.