Problems with rewrite on windows
Igor Sysoev
is at rambler-co.ru
Thu Sep 10 16:24:58 MSD 2009
On Thu, Sep 10, 2009 at 08:12:55AM -0400, halfd wrote:
> Hello everyone!
>
> I am experiencing a rather unsuspected problem with rewrites in nginx on a Windows 2003 server.
>
> I have a system running behind nginx, which generates HTML files and places them
> in folders.
>
> In my config I have following:
>
>
> if (-f $request_filename/index.html) {
> rewrite (.*) $1/index.html break;
> }
>
>
> As you all know, this is to produce clean urls, and this works well in almost all situations.
> Except when one enters an address using non-ascii characters (the site is danish, so they are frequent.)
>
> When I enter the url (ex) /mere/??v/ I get a 404
> The corrosponding line in error.log is
>
> 2009/09/10 13:50:22 4020#3292: *2 "c:/webroot/WEBSITE/site/www/mere/??v/index.html" is not found (3: The system cannot find the path specified), client: MYIPADDR, server: WEBSITE, request: "GET /mere/%C3%A6v/ HTTP/1.1", host: "WEBSITE"
>
>
> And this is in access log :
>
> MYIPADDR - - [10/Sep/2009:13:50:22 +0200] "GET /mere/%C3%A6v/ HTTP/1.1" 404 143 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2"
>
>
> First of all, the path and filename is correct.
> The really weird thing is that when I put the index.html after the URL in the browser (ie) /mere/??v/index.html it works fine!
>
> See this line in access log :
>
> MYIPADDR - - [10/Sep/2009:13:51:15 +0200] "GET /mere/%C3%A6v/index.html HTTP/1.1" 304 0 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2"
>
>
> Here is a request for a straight URL with only ASCII, works fine.
>
> MYIPADDR - - [10/Sep/2009:13:53:50 +0200] "GET /mere/ HTTP/1.1" 304 0 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2"
>
>
> This setup works fine on a linux box and os x, but is giving me headaches on windows :(
>
> Additional info :
> The folder in the example is named "??v", not "%C3%A6v" or the like. This works on the other boxes and when appending index.html to the url.
>
> Any help would be greatly appreciated, many thanks in advance
This is a bug in nginx/Windows.
try_files $uri/index.html
should work.
--
Igor Sysoev
http://sysoev.ru/en/
More information about the nginx
mailing list