Rewrite assistance needed

Igor Sysoev is at rambler-co.ru
Tue May 5 10:42:04 MSD 2009


On Mon, May 04, 2009 at 11:39:14PM -0700, Payam Chychi wrote:

> 2009/5/4 Igor Sysoev <is at rambler-co.ru>:
> > On Tue, May 05, 2009 at 07:53:22AM +0200, John Stykes wrote:
> >
> >> Hi Igor, thanks for the response.
> >>
> >> I have that setting already. The problem is that when the request comes
> >> with a space (%20) or an ampersand (&) it causes problems and nginx
> >> cannot find that directory. So when a request comes for file1.doc in the
> >> directory 'Client Files' it cannot find that directory even if i named
> >> it Client\ Files on the filesystem.
> >>
> >> This is why i thought perhaps i could rewrite the url or the directory
> >> portion so that if a request comes for Client%20Files i simply use a
> >> different directory called clientfiles with no spaces.
> >
> > Could you show the error_log message about these files ?
> > nginx uses decoded names.
> >
> >> thanks
> >> John
> >>
> >>
> >> I have tried using a directory such as
> >>
> >> Igor Sysoev wrote:
> >> > On Tue, May 05, 2009 at 05:59:14AM +0200, John Stykes wrote:
> >> >
> >> >> the problem however occurs when 2 specific requests come to the server
> >> >>
> >> >> but the 2 specific urls above are problematic because of the spaces (in
> >> >> both) and the ampersand (in one).
> >> >>
> >> >> i've tried endless rewrite rules to make the 2 examples above point to a
> >> >> different directory on the filesystem but nginx cannot find the file and
> >> >> i get 404 errors. Filesystem is linux.
> >> >>
> >> >> I have tried using a directory with spaces escaped with \ - no luck
> >> >
> >> > If these files are served by nginx without backend participation,
> >> > the you need just
> >> >
> >> >     location /clientfiles {
> >> >         root  /var/www/data;
> >> >     }
> >>
> >> --
> >> Posted via http://www.ruby-forum.com/.
> >
> > --
> > Igor Sysoev
> > http://sysoev.ru/en/
> >
> >
> 
> could you not look at the request then do a re-write and match for  if
> ( $string =~ s/\\s/\%20/) { ......}  ?
> There is probably a way more elegant way to do this...

I do not undestand the suggestion.
The problem with all these escapes and encodings, that they must be done
only once.


-- 
Igor Sysoev
http://sysoev.ru/en/





More information about the nginx mailing list