A Day in the Life of #Apache
by Rich Bowen, coauthor of Apache
Or, Why I Hate the Apache Web Server
Editor's note: Rich Bowen is back with another installment in his occasional series based on conversations on #apache. In this article, Rich discusses a particular Apache Web Server annoyance--the Options directive--and he explains how it works and why it does what it does. Rich is a coauthor of O'Reilly's Apache Cookbook.
#apache is an IRC channel that runs on the irc.freenode.net IRC network. To join this channel, you need to install an IRC client (XChat, MIRC, and
bitchx are popular clients) and enter the following commands:
/server irc.freenode.net /join #apache
This July, at ApacheCon Europe in Stuttgart, I gave a "Lightning" talk entitled, "Why I Hate the Apache Web Server." The talk contained a lot of things that generally cause irritation on the Apache Web Server. Many of these things need further explanation because, since it was a lightning talk, I only had 5 minutes.
Most of the things covered in the talk were things that come up every day on #apache, and so they are perfect for this series of articles. For the next few installments, I'm going to pick and choose among the things that I was complaining about, but you can see the whole presentation at people.apache.org/~rbowen/presentations/apacheconEU2005/hate_apache.pdf.
Today, we'll start by investigating my first complaint, which has to do with the Options directive. Consider the following two examples (taken from the slide presentation):
Options +Indexes Includes MultiViews Options Indexes Includes Multiviews
Now, these two examples appear almost identical, and it would appear that they should do the same thing. However, they don't. Strangely, the first line disables Indexes, and enables Includes and Multiviews. The second line does what you might more expect; that is, it enables Indexes, Includes, and Multiviews.
One is somewhat torn, at this point, between explaining why it does it that way, and simply explaining how to avoid the problem in the first place. So, we'll do both.
First, the practical question: How can I avoid this problem entirely. Don't mix the +/- syntax with bareword syntax. That is, when using Options, either all items in the list should be prefixed with a + or a -, or none of them should. If you mix, then you're going to have problems.
Now, the more difficult task--explaining how this is supposed to work, and why it does what it does.
The Options directive has the +/- syntax, which appears in a few other directives, such as IndexOptions. There are two possible ways to use the Options directive, as well as the third way, which doesn't work.
When you list a series of Options without modifying them with a + or a - sign, the behavior is to use that as the new list of options. That is, whatever other options are already in place are cleared, and the new list is used instead. For example, if we have:
Options Indexes Options Includes
The documented (and actual) result is that only the Includes option will be enabled. The second Options directive has the effect of completely resetting the existing list (which was Indexes) and replacing it with the new list.
The +/- syntax, on the other hand, has the effect of adding to, or removing from, the existing list. Thus, in this example:
Options Indexes Options +Includes
The result is that Indexes and Includes are both in effect.
Similarly with the - (minus sign) the specified options are removed from the existing list.
Pages: 1, 2