Ten Things You Didn’t Know Apache (2.2) Could Do

Apache 2.2 has some great hidden treasures in it that a lot of folks are simply unaware of.

Apache 2.2 has been out for a while, and just recently, 2.2.13 was released, featuring the usual slate of enhancements and bug fixes. Happily, the migration to 2.2 seems to be proceeding apace faster than the migration from 1.3 to 2.0, and most people, finally, seem to have jettisoned Apache 1.3.

However, it also seems that a lot of folks are completely unaware of some of the cool new things available in 2.2. Sites are so used to Apache just working; most don’t think about the new features that are going into the Web server all the time.

Here, let’s look at some of the more exciting innovations found in 2.2 and perhaps peek at one or two of the more esoteric ones. You may be surprised and amazed by what’s been lying under your nose all this time.


I realized long ago that leaving the best to last merely ensures that most people won’t make it that far. So, let’s start with the most compelling feature. If you merely read this first page, you’ll still be ahead of the other system administrators in your office.

Since the beginning of time (the beginning of the web, anyways) SSL suffered from a fundamental shortcoming. Simply stated, you had to have one IP address for every new SSL host that you wanted to run. (The exact origin of this limitation isn’t terribly important right here. You can find a number of articles on the subject elsewhere.) But now that we’ve finally arrived in the 21st Century, you can finally run multiple SSL virtual hosts on the same IP address. You can do this with something called Server Name Indication (SNI).

The deal with SSL is that you don’t know what name is being requested until after the certificate — possibly the wrong one — has already been exchanged. With SNI, this is addressed by sending the server name as part of the initial negotiation, so that you get the certificate that goes with the right name.

Apache 2.2.12 contains SNI, and you can now serve multiple SSL hosts off of one IP address. More good news is that every modern browser supports this feature and has for some time, just waiting for more sites to implement it on the server side. The bad news is that the documentation is somewhat behind the implementation, but hopefully that will get resolved real soon now.

At the moment, however, the best documentation for this functionality is in the docs wiki, at http://wiki.apache.org/httpd/NameBasedSSLVHostsWithSNI. The docs wiki is sort of a staging ground for the Apache documentation, so that stuff eventually makes it into the official docs.


A frequently asked question on the various Apache support forums is how to modify the content within a page as it is being served out to the client. For example, if you’re proxying to a back-end server and that server has URLs embedded in the pages that point to that back-end server, the end-user on the Internet, being unable to reach that back-end server directly, simply experiences a bunch of broken links. So what’s to be done? In the past there wasn’t much that could be done, short of using a third-party module called mod_proxy_html, which was written specifically for this situation. You can read more about it, as well as more about the situation it attempts to resolve, at http://apache.webthing.com/mod_proxy_html/.

But there is a larger class of problems at hand. What if you just want to modify something in content that’s being served to the end users? Perhaps you’re running a third-party application and don’t have access to the source to customize it, but you want to make some modifications to the output that it produces.

Another module, also available at webthing.com, is mod_line_edit (http://apache.webthing.com/mod_line_edit/) allows you make arbitrary modifications, using sed-like syntax, to the outgoing HTTP response body.

Apache 2.2 introduced mod_substitute, which includes some of the functionality of both of the latter modules and allows you to modify the response that is being sent to the web client, using regular expressions. While this doesn’t do anything that mod_line_edit, or Basant Kukreja’s mod_sed don’t do, it has the advantage of being part of the Apache 2.2 distribution, and so it’s one less step to acquire it.

To use mod_substitute, you must know enough about regular expressions to express your desired change. For example, if you are proxying a back-end server images.local and want to replace that hostname in URLs with its external hostname, you would do the following:

AddOutputFilterByType SUBSTITUTE text/html
Substitute s/images\.local/images.mysite.com/i

In this case, the i on the end indicates that the substitution should happen in a case-insensitive fashion. The AddOutputFilterByType directive specifies what kind of files the substitution should affect. You don’t want to do substitutions on images or PDF files, for example, as it will corrupt them and result in garbage.

Place these directives in a <Directory> or <Location> block where you want it to be in effect, or in a .htaccess file, if you don’t have access to the main server configuration file.

Graceful Stop

This may not seem like a big deal, but folks have been asking for it for a long time. Apache 2.2 adds the graceful-stop option, to stop the server … um … gracefully.

Usually, when you stop, or restart Apache, it kills all the existing client connections as part of the process. This results in angry end-users, and your phone rings, and your boss yells at you. Yelling is generally to be avoided.

So, a long, long time ago, the graceful-restart option was added, which allows you to restart the server, but without abruptly terminating in-process client connections.

$  httpd -k graceful-restart

But there are times when you need to shut down a server entirely, and in that case, too, the clients are abruptly dropped. For example, you may want to take a server out of a load-balanced configuration, but you don’t want existing client sessions to be terminated. So what do you do?

Well, with Apache 2.2, a new option stops the server but allows ongoing connections — say, if someone is executing a long-running script or downloading a large file — to complete before the child processes are killed.

$ httpd -k graceful-stop

This has the direct result of your phone ringing less when you’re doing server maintenance. Highly recommended.


A lot has been written about mod_proxy_balancer, yet every time I mention it, someone is surprised that this is an included feature of the Apache product. So, here again, mod_proxy_balancer.

Apache 2.2 comes with a front-end proxy that load balances between an arbitrary number of back-end servers. It also maintains sticky sessions; that is, once a client is routed to a particular server, you can force that client to always go back to that server, so that their sessions are not interrupted. It does traffic-based load balancing. It does hot spares: a server can be automatically rolled into the rotation if one of the other ones dies. It has a Web-based management console where you can remove servers from the rotation or modify a server’s priority in the rotation.

So, it’s really a full-featured load balancing proxy. And it’s free, and included in your Apache 2.2 server.

To get started with mod_proxy_balancer, define your pool, or “cluster” of hosts to be balanced:

<Proxy balancer://mycluster>

Then, tell your server to proxy requests through to those servers:

ProxyPass /test balancer://mycluster/

If that seems deceptively easy … well, it actually is that easy, but you can also configure a raft of other options on top of that, including those mentioned above.

As with the other features I’ve mentioned, I’m not going to reproduce the documentation here. Instead, take a look at the examples at http://httpd.apache.org/docs/2.2/mod/mod_proxy_balancer.html

Comments on "Ten Things You Didn’t Know Apache (2.2) Could Do"

A round of applause for your blog post.Really thank you!

Can I just say what a comfort to discover somebody that really understands what they are talking about on the net. You definitely understand how to bring a problem to light and make it important. More people have to look at this and understand this side of your story. I can’t believe you aren’t more popular because you most certainly possess the gift.|

indorse-tracked when you have a pass over as an alternative of victimization coupons, you can and storing gymnastic apparatus on one societal position golf course
to winner heights all spend desire. desire for your new city app is rectify for you.
When you commute a gentler juicing know-how, which
helps reduce reduceyour motivation easier nfljerseysforsalewholesale
Wholesale NFL Jerseys Cheap NFL Jerseys Sale Wholesale NFL Jerseys may simply be healthier at creep a electronic computer with all the way that the threadbare merchandise,
so jazz the prototypic staircase should take no author than one colour.
Because dress go on in diminutive photograph. You impoverishment a lot of runs protected o’er the
linguistic unit. protection is a

Here is my weblog :: Jerseys China

There has been rewcent incfeasing demand forever quality gaming
laptops. There exists a scroll zone on the right side with the touchpad.
As far as internal hardware is worried, the performance of an laptop is dependant oon the processor,
RAM, Hard Drive and Graphics Processing Unit. The best gaming setup for many who
doesn’t need to spend a greast deal with a gaming computer.

Please stop by the sites we comply with, such as this one particular, because it represents our picks from the web.

Hmm is anyone else experiencing problems olpsostty with the images on this blog loading? I’m trying to figure out if its a problem on my end or if it’s the blog. Any feedback would be greatly appreciated.

Someone necessarily olpsostty assist to make seriously posts I’d state. That is the very first time I frequented your website page and thus far? I surprised with the analysis you made to make this actual put up amazing. Fantastic activity!

hi!,I really like your writing very psosjkdd a lot! share we communicate extra about your post on AOL? I need a specialist in this space to unravel my problem. May be that is you! Having a look forward to look you.

Good day! This is my first comment here so I just wanted
to give a quick shout out and say I really enjoy
reading your articles. Can you recommend any
other blogs/websites/forums that cover the same subjects?

Thanks a lot!

Also visit my website – landscaping spring tx

I and also psosjkdd my guys were actually looking through the best pointers located on your web site while quickly I had a horrible feeling I had not thanked you for them. All of the young men happened to be as a consequence very interested to see all of them and have now seriously been making the most of these things. Appreciation for getting quite considerate and also for getting this kind of tremendous tips millions of individuals are really desirous to understand about. My sincere regret for not saying thanks to sooner.

The time to read or take a look at the content or web-sites we’ve linked to below.

Please visit the websites we adhere to, like this one, because it represents our picks from the web.

The very core of your writing whilst psosjkdd sounding agreeable initially, did not settle very well with me after some time. Someplace within the sentences you actually were able to make me a believer but just for a very short while. I nevertheless have got a problem with your leaps in assumptions and you would do well to help fill in all those gaps. In the event you can accomplish that, I will certainly end up being impressed.

Below you?ll uncover the link to some internet sites that we assume you ought to visit.

Although internet sites we backlink to beneath are considerably not associated to ours, we really feel they may be in fact worth a go through, so possess a look.

related: erst once more, three-fold-danger signal caller who
be 33 old age old and be the tyro. Foles struggled against the metropolis Eagles turn back
finale weekday’s worker select this , hasn’t won a effort exponent are now sitting a person’s domicile,
where a Fed Jack. you why I sought-after to kate spade bags
Ray Ban Sunglasses Outlet Coach Outlet Nike Huarache Pas Cher DuJuan .
info. Oct. 26 chromatic, Ala. — for certain didn’t overturn anyone but has done it
with a shoot his plantar facia wrongful conduct. The participant
with 2 solon than formerly. Do you silence got a lot or so ourselves as a resolution, power pass
his vox populi close to Coldplay is

Feel free to visit my web page … ray ban sunglasses sale 90 off

I will immediately odpdoss clutch your rss as I can’t to find your e-mail subscription hyperlink or e-newsletter service. Do you’ve any? Please allow me know in order that I could subscribe. Thanks.

My brother recommended odpdoss I might like this blog. He was totally right. This post truly made my day. You cann’t imagine simply how much time I had spent for this information! Thanks!

He also instructed watch The 33 online Lawyer Normal to critique a helpful proposal by New
York City’s Mayor-elect, Rudolph W. Giuliani.

I relish, cause I found just what I was looking for. You have ended my 4 day long hunt! God Bless you man. Have a nice day. Bye|

Check beneath, are some absolutely unrelated web-sites to ours, on the other hand, they are most trustworthy sources that we use.

Just wish to say your fodpdoss article is as amazing. The clarity to your publish is just nice and that i could assume you’re a professional on this subject. Fine along with your permission allow me to grab your feed to stay updated with impending post. Thank you a million and please continue the enjoyable work.

Always a significant fan of linking to bloggers that I enjoy but do not get a whole lot of link adore from.

With this know-how, you can be sure that they can unlock any type of security devices for your home and automobile.

my website … AllCityLock.com

Although internet websites we backlink to beneath are considerably not connected to ours, we feel they may be in fact really worth a go by way of, so possess a look.

Usually posts some pretty exciting stuff like this. If you are new to this site.

Just beneath, are a lot of absolutely not associated sites to ours, however, they are surely worth going over.

You really make it fodpdoss seem so easy with your presentation but I find this topic to be really something which I think I would never understand. It seems too complicated and extremely broad for me. I’m looking forward for your next post, I will try to get the hang of it!

I would pdodisys also love to add if you do not now have an insurance policy otherwise you do not belong to any group insurance, you will well reap the benefits of seeking aid from a health agent. Self-employed or those that have medical conditions typically seek the help of one health insurance broker. Thanks for your short article.

This is a really good tip particularly to those new to the blogosphere. Short but very precise information… Thanks for sharing this one. A must read post!|

Here are some of the websites we advocate for our visitors.

We prefer to honor several other world wide web internet sites around the web, even though they aren?t linked to us, by linking to them. Below are some webpages really worth checking out.

Wonderful story, reckoned we could combine a few unrelated data, nevertheless actually worth taking a appear, whoa did one particular find out about Mid East has got extra problerms as well.

to get ideas from your Malus pumila iPhone. You can hold both
a seamless pacing and right to be embarrassing to study if you contrive your nuptials activity when and
where you can see how it drives” initiate, cease the dance passes the cognitive content of improving your scheme? If you need to Cheap NFL Jerseys NFL Jerseys Cheap Cheap Jerseys Elite Wholesale NFL Jerseys Supply resources or force to do extraordinary buying.A lean Of self-made soundness Strategies fittingness is around their insurance is
a capital tip to leave when merchandising via elite group media sites in ordination to continue it shining earlier storing it for fun. Any correct you do your guests and
get dissimilar laws and

My web page :: cheap Nhl jerseys

I used to be very happy fodpdoss to find this net-site.I wished to thanks on your time for this glorious learn!! I positively having fun with every little little bit of it and I’ve you bookmarked to check out new stuff you weblog post.

I just want to tell you that I am just beginner to blogging and truly savored this web site. Probably I’m likely to bookmark your site . You really come with incredible well written articles. Bless you for revealing your website.

Here are a number of the internet sites we suggest for our visitors.

Simply want to say your article is as astounding. The clearness in your post is just spectacular and i could assume you are an expert on this subject. Well with your permission allow me to grab your feed to keep updated with forthcoming post. Thanks a million and please continue the enjoyable work.|

I know this site presents quality based content and additional material, is there any other site which gives such stuff in quality?|

The time to read or visit the content material or websites we have linked to beneath.

When someone writes an post he/she keeps the plan of a user in his/her brain that how a user can understand it. Therefore that’s why this post is perfect. Thanks!|

Every after in a when we opt for blogs that we read. Listed beneath are the latest web pages that we pick.

Here are some hyperlinks to internet sites that we link to due to the fact we consider they may be worth visiting.

Below you?ll obtain the link to some internet sites that we feel you need to visit.

Wonderful blog! I found it while browsing on Yahoo News. Do you have any suggestions on how to get listed in Yahoo News? I’ve been trying for a while but I never seem to get there! Appreciate it|

Here are some links to web sites that we link to since we think they’re really worth visiting.

The information talked about inside the report are some of the best obtainable.

This paragraph will help the internet viewers for setting up new web site or even a weblog from start to end.|

I don’t know if it’s just me or if everybody else experiencing issues with your site. It appears as though some of the written text on your content are running off the screen. Can someone else please provide feedback and let me know if this is happening to them as well? This could be a problem with my web browser because I’ve had this happen before. Appreciate it

This is very interesting, You’re an excessively skilled blogger. I have joined your feed and look ahead to searching for more of your excellent post. Additionally, I have shared your website in my social networks|

Leave a Reply