You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by hr...@silbergrau.com on 2002/07/03 13:28:43 UTC

SSI

Hi everyone!

I am experiencing problems trying to get SSI with mod_rewrite to work. 
Here a short description of what I am trying to accomplish:

(1) using a special rewrite-rule I want to serve certain pages via a 
servlet running in Tomcat, which gets the originally requested url as a 
request-parameter (to be precise: if the html-page does NOT exist in the 
document root, it is created via Tomcat, otherwise the static page is 
served)  ... I got this working fine
(2) this functionality should also be supported if I include this page in 
a server side include <!--#include virtual="..." --> ... and this does NOT work with my configuration --- the servlet is never 
called!!!

Or to put it into a short example:
(1) if I point my browser to "http://localhost/foo/bar/123.html" my 
servlet on http://somehost:8080/abc/myservlet.shtml gets called (I added 
.shtml to the servlet-name ... don't know if this does any good ?!?)
(2) if I open http://localhost/test.html which looks like this:
...
<!--#include virtual="/foo/bar/123.html" -->
... 
the servlet is NOT executed.

The rewrite-rule in my httpd.conf looks like this:

RewriteEngine on
RewriteLog rewrite.log
RewriteLogLevel 9
RewriteCond "C:/Program Files/Apache 
Group/Apache/htdocs%{REQUEST_FILENAME}"   !-f
RewriteRule (.*)        http://somehost:8080/abc/myservlet.shtml?url=$1 
[T=text/html,P]

So I get the result of the servlet via the internal proxy (P) with 
contenttype text/html (T=...), which works in the first (simple) case 
(without SSI), but it fails when I use server-side-#includes.
Does anybody know what exactly is going wrong and what I can do about it?

BTW:The rewrite.log says something like that:
127.0.0.1 - - [03/Jul/2002:13:20:24 +0200] 
[host.local/sid#795aa8][rid#84f1f8/initial] (2) init rewrite engine with 
requested uri /test.html
127.0.0.1 - - [03/Jul/2002:13:20:24 +0200] 
[host.local/sid#795aa8][rid#84f1f8/initial] (3) applying pattern '(.*)' to 
uri '/test.html'
127.0.0.1 - - [03/Jul/2002:13:20:24 +0200] 
[host.local/sid#795aa8][rid#84f1f8/initial] (4) RewriteCond: 
input='C:/Program Files/Apache Group/Apache/htdocs/test.html' 
pattern='!-f' => not-matched
127.0.0.1 - - [03/Jul/2002:13:20:24 +0200] 
[host.local/sid#795aa8][rid#84f1f8/initial] (1) pass through /test.html
127.0.0.1 - - [03/Jul/2002:13:20:24 +0200] 
[host.local/sid#795aa8][rid#851210/subreq] (2) init rewrite engine with 
requested uri /foo/bar/123.html
127.0.0.1 - - [03/Jul/2002:13:20:24 +0200] 
[host.local/sid#795aa8][rid#851210/subreq] (1) pass through 
/foo/bar/123.html

So it tries to get /foo/bar/123.html but does NOT apply any rewrite-rules 
(which it should to make this example work...)

Any help appreciated
Helmut Rubasch

Re: SSI

Posted by Jeff Beard <je...@cyberxape.com>.
I've used mod_proxy to achieve this.

--Jeff

hru@silbergrau.com wrote:
> 
> Hi everyone!
> 
> I am experiencing problems trying to get SSI with mod_rewrite to work. 
> Here a short description of what I am trying to accomplish:
> 
> (1) using a special rewrite-rule I want to serve certain pages via a 
> servlet running in Tomcat, which gets the originally requested url as a 
> request-parameter (to be precise: if the html-page does NOT exist in the 
> document root, it is created via Tomcat, otherwise the static page is 
> served)  ... I got this working fine
> (2) this functionality should also be supported if I include this page 
> in a server side include <!--#include virtual="..." --> ... and this 
> does NOT work with my configuration --- the servlet is never called!!!
> 
> Or to put it into a short example:
> (1) if I point my browser to "http://localhost/foo/bar/123.html" my 
> servlet on http://somehost:8080/abc/myservlet.shtml gets called (I added 
> .shtml to the servlet-name ... don't know if this does any good ?!?)
> (2) if I open http://localhost/test.html which looks like this:
> ...
> <!--#include virtual="/foo/bar/123.html" -->
> ...
> the servlet is NOT executed.
> 
> The rewrite-rule in my httpd.conf looks like this:
> 
> RewriteEngine on
> RewriteLog rewrite.log
> RewriteLogLevel 9
> RewriteCond "C:/Program Files/Apache 
> Group/Apache/htdocs%{REQUEST_FILENAME}"   !-f
> RewriteRule (.*)        http://somehost:8080/abc/myservlet.shtml?url=$1 
> [T=text/html,P]
> 
> So I get the result of the servlet via the internal proxy (P) with 
> contenttype text/html (T=...), which works in the first (simple) case 
> (without SSI), but it fails when I use server-side-#includes.
> Does anybody know what exactly is going wrong and what I can do about it?
> 
> BTW:The rewrite.log says something like that:
> 127.0.0.1 - - [03/Jul/2002:13:20:24 +0200] 
> [host.local/sid#795aa8][rid#84f1f8/initial] (2) init rewrite engine with 
> requested uri /test.html
> 127.0.0.1 - - [03/Jul/2002:13:20:24 +0200] 
> [host.local/sid#795aa8][rid#84f1f8/initial] (3) applying pattern '(.*)' 
> to uri '/test.html'
> 127.0.0.1 - - [03/Jul/2002:13:20:24 +0200] 
> [host.local/sid#795aa8][rid#84f1f8/initial] (4) RewriteCond: 
> input='C:/Program Files/Apache Group/Apache/htdocs/test.html' 
> pattern='!-f' => not-matched
> 127.0.0.1 - - [03/Jul/2002:13:20:24 +0200] 
> [host.local/sid#795aa8][rid#84f1f8/initial] (1) pass through /test.html
> 127.0.0.1 - - [03/Jul/2002:13:20:24 +0200] 
> [host.local/sid#795aa8][rid#851210/subreq] (2) init rewrite engine with 
> requested uri /foo/bar/123.html
> 127.0.0.1 - - [03/Jul/2002:13:20:24 +0200] 
> [host.local/sid#795aa8][rid#851210/subreq] (1) pass through 
> /foo/bar/123.html
> 
> So it tries to get /foo/bar/123.html but does NOT apply any 
> rewrite-rules (which it should to make this example work...)
> 
> Any help appreciated
> Helmut Rubasch



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org