httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From (Sean Conner)
Subject [users@httpd] Odd interaction between mod_rewrite and mod_cgi
Date Tue, 14 Feb 2006 23:56:13 GMT

  About eight months ago I wrote about this problem.  Today I had some spare
time to test it again, this time with Apache 2.0.55 and it *still* persists.

  First, the original email:

>   I have a few CGI scripts, written in C (legacy stuff that I don't wish to
> rewrite if possible) that work fine under Apache 1.3.  When moved to Apache
> 2.0.54 (latest version) they still work, but Apache seems to include
> additional output at the bottom of the page:
> 	HTTP/1.1 200 OK Date: Sat, 09 Jul 2005 07:14:04 GMT Server:
> 	Apache/2.0.54 (Unix) DAV/2 Content-Length: 0 Connection: close
> 	Content-Type: text/plain
>   Now, the setup.  It's a stock install of Apache 2.0.54 from source, using
> the pre-fork MPM with all the modules installed as DSOs.  CGIs with an
> extention of .cgi can be run from anywhere, and there's one virtual host
> defined:
> 	<VirtualHost>
> 	  ServerName
> 	  ServerAdmin
> 	  DocumentRoot  /home/spc/blog/htdocs
> 	  CustomLog     logs/ combined
> 	  <Directory /home/spc/blog/htdocs>
> 	    AllowOverride       All
> 	    Options             All
> 	  </Directory>
> 	</VirtualHost>
>   The scripts (there are two, one's just purely for testing) that are
> non-parsed headers CGIs, and indeed, if you go to them directly:
>   you can see they work fine.  Now, I also have a .htacess file with some
> mod-rewrite rules:
> 	RewriteEngine on
> 	RewriteBase   /
> 	RewriteRule   ^([0-9][0-9])(.*) nph-blog.cgi/$1$2 [L]
> 	RewriteRule   ^(test)(.*)       nph-raw.cgi/$1$2  [L]
> 	RewriteRule   ^(foo)(.*)        nph-raw.cgi?$1$2  [L]
>   Hit the following URLs:
>   And you'll see the spurious output at the bottom of the pages (at least in
> Firefox and Lynx---the output appears after the </HTML> tag so some browsers
> may ignore it, but it's there).  I did some searches and could not find any
> bugs close to this behavior in Apache 2.0 (this all works fine under Apache
> 1.3, also the main page at is a static page so
> that's why there's no spurious output there).  And nothing appears in the
> error log.
>   Have I actually found a big in Apache 2.0.54?

  Some other notes.  Yes, I've tried

	 RewriteRule   ^([0-9][0-9])(.*) nph-blog.cgi/$1$2 [P,L]

  Doesn't work, since I'm not proxying anything.  I've also tried

	RewriteRule   ^([0-9][0-9])(.*) nph-blog.cgi/$1$2 [T,L]

  And I get the same behavior as above.  I even tried

	 RewriteRule   ^([0-9][0-9])(.*) nph-blog.cgi/$1$2 [PT,L]

  And I *still* get the behavior above, only a bit slower.

Is there anything else I'm missing, or can I finally report this as a bug to
the Apache development team?

  -spc (Or perhaps I should try my luck with 2.2?)

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message