Title: Page 119 – Alex Kirk

---

 * 
   ## 󠀁[Squid’s HTTP Acceleration Mode](https://alex.kirk.at/2005/11/29/squids-http-acceleration-mode/)󠁿
   
 * November 29, 2005
 * I have recently configured a server of mine to use the [Squid Cache](http://www.squid-cache.org/)
   in HTTP Acceleration mode. So what’s this anyway?
 * A typical request to a webserver looks like this: Client browser opens connection
   to server port 80, server sends back the data through that connection. For the
   time of the transfer the server “loses” one child process. So if a client with
   a slow connection requests a large file this can take some minutes. If many slow
   clients block child processes, eventually too few will be left for “ordinary”
   clients.
 * A solution for this is to prepend a proxy server to the HTTP server. The proxy
   server is lightweight and does the communication with the client browser. The
   communication with the web server is done via a high speed interface (either 
   loopback when it’s just one server or an lan with 100(0) mbit), so almost no 
   time is spent waiting for a transfer to finish.
 * Setup is easy, and I’ve [covered this in my thesis](https://alex.kirk.at/papers/caching-strategies/diploma_thesisch6.html#x17-750006.2)
   already.
 * But I’ve got some more real-life info for you.
 * There are two usual ways for setting this up.
    1. Set the web server to listen on port 81, Squid on 80.
    2. Web server still listens on port 80 but just for 127.0.0.1, the loopback interface.
       Squid listens on port 80 on the external interface.
 * What makes number two the favourable is that you are not haveing a server process
   listening on an unconventional port, and, for redirects (`Location: /somewhereelse`)
   the port number is correct (see the [corresponding question in the Squid FAQ](http://www.squid-cache.org/Doc/FAQ/FAQ-20.html#ss20.3)).
   For existing configurations with virtual hosts there is no need to change a `
   < VirtualHost *:80>` to `< VirtualHost *:81>`.
 * So in `ports.conf` of Apache, for example, you change this:
    ` # Listen 80 Listen
   127.0.0.1:80
 * In `squid.conf` you do these changes (apart from those listed in [my thesis](https://alex.kirk.at/papers/caching-strategies/diploma_thesisch6.html#x17-750006.2)):
   `#
   http_port 3128 http_port ip.add.re.ss:80
 * So this works nice already, but there is one more thing. Now the source address
   for a http request is `127.0.0.1`. So if you want to do some processing with 
   the `REMOTE_ADDR`, for example in PHP, you’d have to insert something like this
   before you’d could use the address again.
    ` if (isset($_SERVER["HTTP_VIA"])){//
   squid http accel $_SERVER["REMOTE_ADDR"] = $_SERVER["HTTP_X_FORWARDED_FOR"]; }
 * Also in the log files there is now a `127.0.0.1` as source instead of the real
   ip address. The following changes things back to normal (in `apache2.conf`):
   `#
   LogFormat "%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i"" combined LogFormat"%{
   X-Forwarded-For}i %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i"" combined
 * This should be all for now. Happy speed-boosting ;)
 * [Misc](https://alex.kirk.at/category/misc/), [Web](https://alex.kirk.at/category/web/)
 * 
   ## 󠀁[Favicon caching](https://alex.kirk.at/2005/11/28/favicon-caching/)󠁿
   
 * November 28, 2005
 * Hello there,
 * You may have noticed that your blummy now opens a bit faster. This is due to 
   a new feature:
    - [Feature] Favicons are cached on the blummy server.
 * So now your blummy will not hesitate to open because some server is not ready
   to serve his icon.
 * I hope this causes some speed-ups ;)
 * PS: In the first few hours there could be some hick-ups with caching, as some
   servers might be down while filling up the cache.
 * [blummy](https://alex.kirk.at/category/projects/blummy/)

 [Previous Page](https://alex.kirk.at/page/118/?output_format=md&term_id=1122) [Next Page](https://alex.kirk.at/page/120/?output_format=md&term_id=1122)