Hello list,
I got an issue with a filename containing "strange" characters.
It seems that nginx is not able to url_decode correctly, and then get
the
right file.
Yes, the filename is ugly : "Capture dcran 2010-09-25 08.30.07.png"
but apache is able to read it, and nginx is not :
nginx strace :
open("/<path>/images/Capture%20d%E2%80%99%C3%A9cran%202010-09-25%20%C3%A0%2008.30.07.png",
O_RDONLY|O_NONBLOCK) = -1 ENOENT (No such file or directory)
apache strace :
open("/<path>/images/Capture d\342\200\231\303\251cran 2010-09-25
\303\240
08.30.07.png", O_RDONLY|O_CLOEXEC) = 100
So it seems that nginx is using the url_encoded version of the filename,
while apache do it's own thing on it.
On both apache and nginx, the access log says : "GET
/images/Capture%20d%E2%80%99%C3%A9cran%202010-09-25%20%C3%A0%2008.30.07.png"
both server have the same locales settings, and I tried different
charset
configuration into nginx, but no luck..
Any idea how I can fix that without changing the filename (sadly, it's
not
possible :/) ?
Thanks
Nilshar
on 2012-11-13 09:33
on 2012-11-13 09:39
On Nov 13, 2012, at 12:32 , Nilshar wrote: > > apache strace : > open("/<path>/images/Capture d\342\200\231\303\251cran 2010-09-25 \303\240 08.30.07.png", O_RDONLY|O_CLOEXEC) = 100 > > So it seems that nginx is using the url_encoded version of the filename, while apache do it's own thing on it. > > On both apache and nginx, the access log says : "GET /images/Capture%20d%E2%80%99%C3%A9cran%202010-09-25%20%C3%A0%2008.30.07.png" > > both server have the same locales settings, and I tried different charset configuration into nginx, but no luck.. > > Any idea how I can fix that without changing the filename (sadly, it's not possible :/) ? The most probably there is a rewrite in configuration which changes URI to $request_uri. nginx escapes URI if no one interferes.
on 2012-11-13 09:42
On 13 November 2012 09:38, Igor Sysoev <igor@sysoev.ru> wrote: > > > The most probably there is a rewrite in configuration which changes URI to > $request_uri. > nginx escapes URI if no one interferes. > > > -- > Igor Sysoev > http://nginx.com/support.html > > Yes indeed, there is a rewrite ! got a tip on how to fix that ?
on 2012-11-13 10:01
On Nov 13, 2012, at 12:41 , Nilshar wrote: >> >> both server have the same locales settings, and I tried different charset configuration into nginx, but no luck.. >> >> Any idea how I can fix that without changing the filename (sadly, it's not possible :/) ? > > > The most probably there is a rewrite in configuration which changes URI to $request_uri. > nginx escapes URI if no one interferes. > > > Yes indeed, there is a rewrite ! > got a tip on how to fix that ? The general rule is to not use rewrites at all: they make configuration to a mess.
on 2012-11-13 10:23
On 13 November 2012 10:01, Igor Sysoev <igor@sysoev.ru> wrote: >> right file. >> \303\240 08.30.07.png", O_RDONLY|O_CLOEXEC) = 100 >> Any idea how I can fix that without changing the filename (sadly, it's > > > The general rule is to not use rewrites at all: they make configuration to > a mess. > > > > -- > Igor Sysoev > http://nginx.com/support.html > Hum... well ok, if I read it right, it is recommanded to use try_files instead right ? Problem is that it seems that try_files is not allowed inside a "if"... Well.. maybe someone will be able to point me a better conf, here what I'm trying to do : location ~ ^/(media|files|list|album|images)/ { root /; if ($host ~* "^(.)(.)(.*)\.example.com$") { set $dir1 $1; set $dir2 $2; set $dir3 $3; rewrite ^ /<path>/ www.example.com/$dir1/$dir2/$dir1$dir2$dir3$request_uri? break; } } So I should be able to remove the if so try_files might be happy, but I do not know how to set the 3 dir w/o the if statement.. I tried several things, so far no luck. Nilshar
on 2012-11-13 10:42
On Tue, Nov 13, 2012 at 10:22:53AM +0100, Nilshar wrote: > >> I got an issue with a filename containing "strange" characters. > >> apache strace : > >> configuration into nginx, but no luck.. > > Yes indeed, there is a rewrite ! > Well.. maybe someone will be able to point me a better conf, here what I'm > } > } > > So I should be able to remove the if so try_files might be happy, but I do > not know how to set the 3 dir w/o the if statement.. > I tried several things, so far no luck. server { server_name ~^(?<dir1>.)(?<dir2>.)(?<dir3>.*)\.example\.com$; root /path/www.example.com/$dir1/$dir2/$dir1$dir2$dir3; location /media/ { } location /files/ { } location /list/ { } location /album/ { } location /images/ { } location / { return 404; } } -- Igor Sysoev http://nginx.com/support.html
on 2012-11-13 10:48
On 13 November 2012 10:41, Igor Sysoev <igor@sysoev.ru> wrote: > > >> > > >> > > >> > > >> > > > > > trying to do : > > } > > -- > Igor Sysoev > http://nginx.com/support.html > Well... simple, clear and... works perfectly ! very hard to switch from an apache logic to a nginx logic, but I'll improve :p Thanks a lot Igor ! Nilshar.
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.