You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Nick Glencross <ni...@glencros.demon.co.uk> on 2003/04/20 14:37:42 UTC
[users@httpd] Strange rewrite behaviour on alternate hits?
Hi,
Although I've been using Apache for CGI scripting for a few years, I'm a
newbie on mod_rewrite.
What I was trying to do is make the web server effectively ignore the
URL, and always run the same single CGI script.
mod_rewrite seems the best way to do this (correct me if I'm wrong!).
I'm using the version that comes with apache-2.0.44 on gentoo.
I've added the following three Rewrite* commands to the <Directory />
section in commonapache2.conf.
--------------
<Directory />
Options -All -Multiviews
AllowOverride None
RewriteEngine on
RewriteCond %{REQUEST_URI} !/cgi-bin/hello$
RewriteRule .* /cgi-bin/hello?
<IfModule mod_access.c>
Order deny,allow
Deny from all
</IfModule>
</Directory>
--------------
For now, the CGI script is simply:
#!/usr/bin/perl
use CGI qw/:standard/ ;
print header () ;
print start_html ('Hello') ;
print "Hello from HTML!\n" ;
print end_html ;
and when you run it, you get
Content-Type: text/html; charset=ISO-8859-1
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
lang="en-US"><head><title>Hello</title>
</head><body>Hello from HTML!
</body></html>
So far so good, so regardsless of what url you enter, you get:
"Hello from HTML!"
BUT... then on the next hit have to wait a while and get
"0 HTTP/1.1 200 OK Date: Sun, 20 Apr 2003 12:30:35 GMT Server:
Apache/2.0.44 (Gentoo/Linux) Keep-Alive: timeout=15, max=99 Connection:
Keep-Alive Transfer-Encoding: chunked Content-Type: text/html;
charset=ISO-8859-1 129 Hello from HTML! 0 0"
I see the timeout=15, and indeed there is roughly a 15 second wait.
Refresh, and things are ok. The problem seems to happen on alternate hits.
Now, if I browse "http://localhost/cgi-bin/hello" directly, there is
never a problem, so it really does look as though it is rewrite specific.
Can anyone shed any light on why I'm experiencing this, and even better,
provide a solution to what I'm trying to do.
Thanks in advance,
Nick Glencross
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Strange rewrite behaviour on alternate hits?
Posted by Nick Glencross <ni...@glencros.demon.co.uk>.
Nick Glencross wrote:
> Nick Glencross wrote:
>
>> Refresh, and things are ok. The problem seems to happen on alternate
>> hits.
>
> As a bit more info to this, changing the mozilla HTTP Networking
> setting to HTTP 1.0 (or disabling the Keep-Alive?) seems to 'fix' it.
> This isn't a solution (as I can't ask people to make this change), but
> perhaps a useful experiment. Can anyone see how this might affect
> mod_rewrite?
Looks like this is fixed in 2.0.45. Thanks everyone!
Nick
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Strange rewrite behaviour on alternate hits?
Posted by Nick Glencross <ni...@glencros.demon.co.uk>.
Nick Glencross wrote:
> Refresh, and things are ok. The problem seems to happen on alternate
> hits.
As a bit more info to this, changing the mozilla HTTP Networking setting
to HTTP 1.0 (or disabling the Keep-Alive?) seems to 'fix' it. This isn't
a solution (as I can't ask people to make this change), but perhaps a
useful experiment. Can anyone see how this might affect mod_rewrite?
Thanks,
Nick Glencross
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org