2009年7月21日星期二

RE: [fw-mvc] Router thinks mysite.com/js/my/customDojoClass.js is a valid controller - how to change?

When I first came across this, I simply turned off rewrite in the .htaccess in the Dojo parent directory. Any reason to leave redirection on in the Dojo directory tree?

I'm glad to hear that I won't need to do this when using a layer, so maybe this is just a dev/test environment patch.

-----Original Message-----
From: ert256 [mailto:ert256@gmail.com]
Sent: Monday, July 20, 2009 8:05 AM
To: dante@dojotoolkit.org
Cc: fw-mvc@lists.zend.com
Subject: Re: [fw-mvc] Router thinks mysite.com/js/my/customDojoClass.js is a valid controller - how to change?

Yes, there is 404 after request, but still, if it's going through ZF,
there is heavy load on application. We don't need that. It's extra 4, or
more request per new user (if 404 is cached ). If there is no cache, load
will be bigger. Can we afford that ?

My answer is simple - just block /js from rewrite rules.
No special patterns needed.

Peter E Higgins <dante@dojotoolkit.org>
[Mon, 20 Jul 2009 09:01:09 -0400] :

> These 404's go away after running a build. It is a limitation of the
> i18n bundle loading for Dijit trying to determine which locale bundle to
> use (404's means fall back to next) in non-built-scenarios. A few other
> .html files in the Dojo tree are [optionally] required for operation
> (blank.html for io.iframe, etc) and will cause a similar issue (though
> the updated mod_rewrite rules for ZF I believe now check for file-exists
> which solves that issue).
>
> The pattern for all i18n bundles is something like: .*/nls/[locale]/*.js
> -- you could probably add a rewrite rule for nls/ specifically?
>
> Regards,
> Peter
>
> ert256 wrote:
> > I found , that there are few missing js files, requested by
> > dojo(dijit?).
> >
> > I'm just blocking from mod_rewrite matching all files in /js
> > directory, so there will be no such extra-load on my application.
> >
> > Example of such files :
> > dijit/form/nls/en/Textarea.js
> > dijit/form/nls/en-us/Textarea.js
> > dijit/_editor/nls/en/commands.js
> > dijit/_editor/nls/en-us/commands.js
> >
> > Greetings
> > clon <lauri@praktik.ee>
> > [Thu, 16 Jul 2009 10:29:55 -0700 (PDT)] :
> >
> >
> >> Hi!
> >>
> >> We use something like:
> >>
> >> RewriteEngine On
> >> RewriteRule favicon.ico public/favicon.ico [L]
> >> RewriteRule robots.txt public/robots.txt [L]
> >> RewriteRule !public index.php
> >>
> >> This should be rewritten to index.php:
> >> example.com/module/controller/action
> >>
> >> Just keep your js, css and images in the /public directory tree, like
> >> so: example.com/public/css/styles.css
> >> example.com/public/images/background.png
> >>
> >> Lauri
> >>
> >>
> >> Nathan Garlington wrote:
> >>
> >>> Thanks for the reply Matthew. In my .htaccess:
> >>>
> >>> **************
> >>> # .htaccess for mysite.org (/public_html/mysite)
> >>>
> >>> DirectoryIndex index.php
> >>>
> >>> RewriteEngine On
> >>> RewriteCond %{REQUEST_FILENAME} -s [OR]
> >>> RewriteCond %{REQUEST_FILENAME} -l [OR]
> >>> RewriteCond %{REQUEST_FILENAME} -d
> >>> RewriteRule ^.*$ - [NC,L]
> >>> RewriteRule ^.*$ index.php [NC,L]
> >>> **********
> >>> In spite of the above rewrite declarations, I still get the
> >>> previously mentioned exception.
> >>> As you can see, this particular usage of ZF on a subdomain. Should I
> >>> be setting the baseUrl in the front controller? And it's odd that the
> >>> only time I get this particular error is when my login controller is
> >>> being used. Doesn't seem to occur with any other controllers. But all
> >>> the page requests access the same .htaccess so I'm not sure what the
> >>> difference is, and most of my controllers/views use xhr or at least
> >>> dojo in some way. Could there be something going on with my
> >>> implementation that is causing this error? Just kinda throwing things
> >>> out there because I really don't know what the problem is.
> >>>
> >>> --
> >>> Regards,
> >>> Nathan @ T&R Trailer Sales
> >>>
> >>> Tel: 719-546-2321
> >>> Fax: 719-404-4697
> >>>
> >>>
> >>> On Thu, Jul 16, 2009 at 8:53 AM, Matthew Weier O'Phinney
> >>> <matthew@zend.com> wrote:
> >>>
> >>>> -- Nathan Garlington <garlinto@gmail.com> wrote
> >>>> (on Thursday, 16 July 2009, 08:42 AM -0600):
> >>>>
> >>>>> (1.8.4) I was looking over my server error logs and noticed a
> >>>>> number of
> >>>>>
> >>>> errors
> >>>>
> >>>>> like the following:
> >>>>>
> >>>>> ***
> >>>>> Uncaught exception 'Zend_Controller_Dispatcher_Exception' with
> >>>>> message
> >>>>>
> >>>> 'Invalid
> >>>>
> >>>>> controller specified (js)' in
> >>>>>
> >>>> /home1/tandrtra/Zend/Controller/Dispatcher/
> >>>>
> >>>>> Standard.php:241
> >>>>> Stack trace:
> >>>>> #0 /home1/tandrtra/Zend/Controller/Front.php(945):
> >>>>> Zend_Controller_Dispatcher_Standard-&gt;dispatch(Object
> >>>>> (Zend_Controller_Request_Http),
> >>>>> Object(Zend_Controller_Response_Http))
> >>>>> #1 /home1/tandrtra/public_html/inv/index.php(47):
> >>>>>
> >>>> Zend_Controller_Front-&gt;
> >>>>
> >>>>> dispatch()
> >>>>> #2 {main}
> >>>>> thrown in /home1/tandrtra/Zend/Controller/Dispatcher/Standard.php
> >>>>> on line 241
> >>>>> ***
> >>>>>
> >>>>> I was looking through the manual, but I'm not sure how to tell the
> >>>>>
> >>>> router that
> >>>>
> >>>>> the route:
> >>>>>
> >>>>> example.com/js/*
> >>>>>
> >>>>> should be left alone. I'm sure this could probably be handled in
> >>>>> the
> >>>> rewrite
> >>>>
> >>>>> definitions in .htaccess, but since the rewrite rules are fairly
> >>>>> alien
> >>>>>
> >>>> to me,
> >>>>
> >>>>> can I configure the router to accomplish this for me?
> >>>>>
> >>>> Use the recommended rewrite rules from the manual. mod_rewrite is
> >>>> determining where to send the request, and the recommended rules
> >>>> were written precisely to ensure that public resources such as JS,
> >>>> CSS, etc. in the document root are not served by ZF.
> >>>>
> >>>> --
> >>>> Matthew Weier O'Phinney
> >>>> Project Lead | matthew@zend.com
> >>>> Zend Framework | http://framework.zend.com/
> >>>>
> >>>
> >
> >
> > ß
> > Rafał (ert16) Trójniak
> > m@il : ert256@gmail.com
> > Jid : ert256@gmail.com
> > GPG key-ID : 3F38968F
> > 4711 E3BC B674 C841 BED8
> > 0F8F 69D3 80CF 3F38 968F
> >
>
>


ß
Rafał (ert16) Trójniak
m@il : ert256@gmail.com
Jid : ert256@gmail.com
GPG key-ID : 3F38968F
4711 E3BC B674 C841 BED8
0F8F 69D3 80CF 3F38 968F

没有评论: