You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Vincent Bray <no...@gmail.com> on 2007/06/23 10:08:22 UTC
Re: [users@httpd] Excluding filetypes with
On 23/06/07, Ioannis Cherouvim <jc...@eworx.gr> wrote:
> Hello
Hi,
> I want to forward all http requests to tomcat, except from static files
> such as jpg, png etc.
>
> <LocationMatch
> "^/(?!(*.js|*.png|*.jpg|*.bmp|*.gif|*.ico|*.swf|*.xml|*.pdf|*.doc|*.xls|*.zip|*.txt))">
> JkUriSet worker ajp13:localhost:8009
> </LocationMatch>
You seem to have your regex syntax a little muddled. You've got (?!
which is fine for negative lookahead, but *. is shell wildcard syntax,
not regex.
<LocationMatch (?!(js|png|etc)$)>
.. perhaps, though I haven't tried it. It's a shame you're not using
the more up-to-date mod_proxy_ajp rather than mod_jk as then you'd be
able to use mod_rewrite for this and get negated matching, rather than
confusing assertions.
--
noodl
---------------------------------------------------------------------
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] Excluding filetypes with
Posted by Vincent Bray <no...@gmail.com>.
On 23/06/07, Ioannis Cherouvim <jc...@eworx.gr> wrote:
> <LocationMatch (?!(js|png|jpg|bmp|gif|ico|swf|xml|pdf|doc|xls|zip|txt)$)>
> JkUriSet worker ajp13:localhost:8009
> </LocationMatch>
>
> I tried this, but still, it seems that everything is being served by
> tomcat. When I hit http://example.com/foo.txt and tomcat is down, I get
> an error 500 (Internal Server Error).
That doesn't sound right, but then I get mod_jk doesn't consider
itself to operate like a proxy so doesn't use 503. I may have fluffed
the regex syntax too, I'm not sure if that $ anchor is in the right
place with respect to the assertion. Try (?!(\.(js|png|jpg|etc)$))
Ideally I guess you'd say "send this to tomcat unless it exists in the
document root", rather than listing arbitrary file extensions.
> With mod_proxy_ajp I will be able to use the JkMount and JkUnMount
> directives?
No, you use apache's ProxyPass family of directives, but instead of
proxying to http:// addresses you proxy to ajp://
Sadly the docs are a little spartan, so try the second link first.
http://httpd.apache.org/docs/2.2/mod/mod_proxy_ajp.html
http://people.apache.org/~mturk/docs/article/ftwai.html
--
noodl
---------------------------------------------------------------------
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] Excluding filetypes with
Posted by Ioannis Cherouvim <jc...@eworx.gr>.
>
> You seem to have your regex syntax a little muddled. You've got (?!
> which is fine for negative lookahead, but *. is shell wildcard syntax,
> not regex.
>
> <LocationMatch (?!(js|png|etc)$)>
>
> .. perhaps, though I haven't tried it. It's a shame you're not using
> the more up-to-date mod_proxy_ajp rather than mod_jk as then you'd be
> able to use mod_rewrite for this and get negated matching, rather than
> confusing assertions.
>
Thanks for your reply.
<LocationMatch (?!(js|png|jpg|bmp|gif|ico|swf|xml|pdf|doc|xls|zip|txt)$)>
JkUriSet worker ajp13:localhost:8009
</LocationMatch>
I tried this, but still, it seems that everything is being served by
tomcat. When I hit http://example.com/foo.txt and tomcat is down, I get
an error 500 (Internal Server Error).
With mod_proxy_ajp I will be able to use the JkMount and JkUnMount
directives?
thanks
---------------------------------------------------------------------
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