You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Alois Treindl <al...@astro.ch> on 2004/06/17 23:12:06 UTC
[users@httpd] addhandler changes between Apache 1.3 and 2.0
Background story
----------------
I have upgraded a busy http server from Apache 1.3 to 2.0
and have run into a problem.
We run a CGI which handles all requests for html files,
by processing them to insert session onformation and other
user-dependetn data.
In httpd.conf this is done by
Action link-translate /cgi/xa.cgi
AddHandler link-translate .htm
AddHandler link-translate .html
We run a multilingual website im 7 languages, and many html pages exist
in various languages, usually indicated by the filename, like
file_g.htm for german
file_e.htm for english etc.
Not all files exist in all languages, and the CGI handler
has some intelligence built in.
if, for example, file_s.htm (spanish) does not exist, it serves the
english version with a note saying that translation is missing.
Now the description of my problem:
----------------------------------
In Apache 1.3, the handler CGI was also called of the requested
html file did not actually exist. This allowed our language-replacement
feature.
In Apache 2.0 the handler is only called when the requested file
actually exists. If a file is missing, the handler CGI is never called,
and the regular 'missing document' action is taken.
Can someone confirm that such a change of behaviour really exists
between 1.3 and 2.0, and is there a way to get the original mode back
(handler for *.htm is always called, even if document is missing)?
of course there exist other solutions for my language-replacement
(Rewrite), but I would first like to know whether the Addhandler logic
has really changed, and whether anything can be done about it.
Alois
---------------------------------------------------------------------
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] addhandler changes between Apache 1.3 and 2.0
Posted by André Malo <nd...@perlig.de>.
* Alois Treindl <al...@astro.ch> wrote:
> # in Apache 2.0, the Addhandler directive does not work to give .htm
> # requests to xa.cgi if the requested file is missing.
> # for this case, we use this extra redirect
> RewriteCond /www/docs/%{REQUEST_FILENAME} \.htm$
> RewriteCond /www/docs/%{REQUEST_FILENAME} !-f
> RewriteRule /(.*) /cgi/xa.cgi/$1 [L,R]
>
> If I leave the [R] flag out, the redirect is done to
> /www/docs/cgi/xa.cgi
> which of course does not work, as the /cgi/ directory is not within
> the documents directory /www/docs
OK. Try to replace the R flag with PT.
nd
---------------------------------------------------------------------
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] addhandler changes between Apache 1.3 and 2.0
Posted by Robert Andersson <ro...@profundis.nu>.
Alois Treindl wrote:
> # in Apache 2.0, the Addhandler directive does not work to give .htm
> # requests to xa.cgi if the requested file is missing.
> # for this case, we use this extra redirect
> RewriteCond /www/docs/%{REQUEST_FILENAME} \.htm$
> RewriteCond /www/docs/%{REQUEST_FILENAME} !-f
> RewriteRule /(.*) /cgi/xa.cgi/$1 [L,R]
>
> If I leave the [R] flag out, the redirect is done to
> /www/docs/cgi/xa.cgi
> which of course does not work, as the /cgi/ directory is not within
> the documents directory /www/docs
As long as you have the [R] flag, the user *will* se the rewritten URI, so
you'll need a way to get rid of it.
I have not utilized mod_rewrite in that way, but the docs suggests that the
substitution can be a real filesystem path, so you might be able to just do:
RewriteRule /(.*) /path/to/cgi/xa.cgi/$1 [L]
I'm asuming /cgi is an alias of some sort, so as indicated by the docs:
"'passthrough|PT' (pass through to next handler)
This flag forces the rewriting engine to set the uri field of the
internal
request_rec structure to the value of the filename field. This flag is
just a hack to be able to post-process the output of RewriteRule
directives by Alias, ScriptAlias, Redirect, etc. directives from other
URI-to-filename translators. [...]"
Replacing [R] with [PT] might do the trick also, and seems preferable.
Regards,
Robert Andersson
---------------------------------------------------------------------
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] addhandler changes between Apache 1.3 and 2.0
Posted by Alois Treindl <al...@astro.ch>.
On Fri, 18 Jun 2004, [ISO-8859-15] André Malo wrote:
> * Alois Treindl <al...@astro.ch> wrote:
>
> > > You could setup a rewriterule as a workaround until it's fixed.
> >
> > I have done that, but now the rewritten URL appears in the browser,
> > i.e. the users see
> > http:.../cgi/xa.cgi/filename.htm
> >
> > Is there a way to do rewriting without the user's seeing the redirection?
>
> Sure. Could you supply your configuration, please?
# in Apache 2.0, the Addhandler directive does not work to give .htm
# requests to xa.cgi if the requested file is missing.
# for this case, we use this extra redirect
RewriteCond /www/docs/%{REQUEST_FILENAME} \.htm$
RewriteCond /www/docs/%{REQUEST_FILENAME} !-f
RewriteRule /(.*) /cgi/xa.cgi/$1 [L,R]
If I leave the [R] flag out, the redirect is done to
/www/docs/cgi/xa.cgi
which of course does not work, as the /cgi/ directory is not within
the documents directory /www/docs
---------------------------------------------------------------------
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] addhandler changes between Apache 1.3 and 2.0
Posted by André Malo <nd...@perlig.de>.
* Alois Treindl <al...@astro.ch> wrote:
> > You could setup a rewriterule as a workaround until it's fixed.
>
> I have done that, but now the rewritten URL appears in the browser,
> i.e. the users see
> http:.../cgi/xa.cgi/filename.htm
>
> Is there a way to do rewriting without the user's seeing the redirection?
Sure. Could you supply your configuration, please?
nd
---------------------------------------------------------------------
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] addhandler changes between Apache 1.3 and 2.0
Posted by Alois Treindl <al...@astro.ch>.
André Malo wrote:
> * Alois Treindl <al...@astro.ch> wrote:
>
>
>>Now the description of my problem:
>>----------------------------------
>>
>>In Apache 1.3, the handler CGI was also called of the requested
>>html file did not actually exist. This allowed our language-replacement
>>feature.
>>
>>In Apache 2.0 the handler is only called when the requested file
>>actually exists. If a file is missing, the handler CGI is never called,
>>and the regular 'missing document' action is taken.
>>
>>Can someone confirm that such a change of behaviour really exists
>
>
> Yes. See
> <http://issues.apache.org/bugzilla/show_bug.cgi?id=28553>
> (Actually it's not a real *change* of the behaviour. The possibility of
> virtual locations was never ported *forward* to 2.0 ;) (it appeared after the
> big fork).
>
>
>>between 1.3 and 2.0, and is there a way to get the original mode back
>>(handler for *.htm is always called, even if document is missing)?
>
>
> You could setup a rewriterule as a workaround until it's fixed.
I have done that, but now the rewritten URL appears in the browser,
i.e. the users see
http:.../cgi/xa.cgi/filename.htm
Is there a way to do rewriting without the user's seeing the redirection?
---------------------------------------------------------------------
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] addhandler changes between Apache 1.3 and 2.0
Posted by André Malo <nd...@perlig.de>.
* Alois Treindl <al...@astro.ch> wrote:
> Now the description of my problem:
> ----------------------------------
>
> In Apache 1.3, the handler CGI was also called of the requested
> html file did not actually exist. This allowed our language-replacement
> feature.
>
> In Apache 2.0 the handler is only called when the requested file
> actually exists. If a file is missing, the handler CGI is never called,
> and the regular 'missing document' action is taken.
>
> Can someone confirm that such a change of behaviour really exists
Yes. See
<http://issues.apache.org/bugzilla/show_bug.cgi?id=28553>
(Actually it's not a real *change* of the behaviour. The possibility of
virtual locations was never ported *forward* to 2.0 ;) (it appeared after the
big fork).
> between 1.3 and 2.0, and is there a way to get the original mode back
> (handler for *.htm is always called, even if document is missing)?
You could setup a rewriterule as a workaround until it's fixed.
nd
--
sub the($){+shift} sub answer (){ord q
[* It is always 42! *] }
print the answer
# André Malo # http://pub.perlig.de/ #
---------------------------------------------------------------------
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