]> sipb.mit.edu Git - ikiwiki.git/blob - doc/bugs/po:_apache_config_serves_index.rss_for_index.mdwn
remove some links to gitweb
[ikiwiki.git] / doc / bugs / po:_apache_config_serves_index.rss_for_index.mdwn
1 The apache config documented in [[plugins/po]] has a subtle bug. It works
2 until a site gets an index.atom or index.rss file. (Acutally, with po
3 enabled, they're called index.en.atom or index.en.rss etc, but the result
4 is the same).
5
6 Then, when wget, curl, or w3m is pointed at http://site/, apache serves
7 up the rss/atom file rather than the index page.
8
9 Analysis:
10
11 * /etc/mime.types gives mime types to .rss and .atom files
12 * `mod_negotiation`'s MultiViews allows any file with a mime type to be
13   served up via content negotiation, if the client requests that type.
14 * wget etc send `Accept: */*` to accept all content types. Compare
15   with firefox, which sends `Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*`
16 * So apache has a tie between a html encoded Enlish file, and a rss encoded
17   English file and the client has no preference. In a tie, apache will serve up the
18   *smallest* file, which tends to be the rss file. (Apache's docs say it uses that
19   strange criteria to break ties; see <http://httpd.apache.org/docs/2.0/mod/mod_mime.html#multiviewsmatch>)
20
21 The only way I have found to work around this problem is to remove
22 atom and rss from /etc/mime.types. Of course, that has other undesirable
23 results. 
24
25 I wonder if it would be worth making the po plugin generate apache 
26 [type map files](http://httpd.apache.org/docs/2.0/mod/mod_negotiation.html#typemaps).
27 That should avoid this problem.
28 --[[Joey]]
29
30 Update: A non-intrusive fix is to add this to apache configuration. 
31 This tunes the "quality" of the rss and atom files, in an apparently currently
32 undocumented way (though someone on #httpd suggested it should get documented).
33 Result is that apache will prefer serving index.html. --[[Joey]]  [[done]]
34
35         AddType application/rss+xml;qs=0.8 .rss
36         AddType application/atom+xml;qs=0.8 .atom