id summary reporter owner description type status priority milestone component version resolution keywords cc uname nginx_version 304 rewrite break doesn't work with index Mike Robertson "The `rewrite` doesn't interact properly with the `index` command. Suppose I have this configuration: {{{ events {} http { include mime.types; default_type text/plain; server { listen 8080; location / { return 200 ""requested $document_uri""; } location ~ ^/~(?[^/]+) { root ""/Users/$user/Sites""; index index.html; rewrite ^[^/]*/~(?[^/]+)(?.*)$ $rest break; } } } }}} I expect when I do a request for `~mikerobe/` that it will remap the request to the local file `/Users/mikerobe/Sites/index.html` (which exists). However, when I submit the request, nginx incorrectly hits the `location /` block. {{{ mikerobe supamac> cat get.tcp GET /~mikerobe/ HTTP/1.1 Host: localhost Connection: close mikerobe supamac> cat get.tcp|nc localhost 8080 HTTP/1.1 200 OK Server: nginx/1.2.6 Date: Mon, 18 Feb 2013 16:47:20 GMT Content-Type: text/html Content-Length: 21 Connection: close requested /index.html }}} Only if I change the request to `~mikerobe/index.html` does it return the expected page: {{{ mikerobe supamac> cat get.tcp GET /~mikerobe/index.html HTTP/1.1 Host: localhost Connection: close mikerobe supamac> cat get.tcp|nc localhost 8080 HTTP/1.1 200 OK Server: nginx/1.2.6 Date: Mon, 18 Feb 2013 16:49:27 GMT Content-Type: text/html Content-Length: 83 Last-Modified: Mon, 18 Feb 2013 16:39:49 GMT Connection: close Accept-Ranges: bytes Real Index }}} " defect closed major nginx-module 1.3.x invalid Darwin supamac.local 12.2.0 Darwin Kernel Version 12.2.0: Sat Aug 25 00:48:52 PDT 2012; root:xnu-2050.18.24~1/RELEASE_X86_64 x86_64 i386 iMac11,1 Darwin "nginx version: nginx/1.3.10 built by clang 4.0 (tags/Apple/clang-421.0.60) (based on LLVM 3.1svn) TLS SNI support enabled configure arguments: --prefix=/usr/local/Cellar/nginx/1.3.10 --with-http_ssl_module --with-pcre --with-ipv6 --with-cc-opt=-I/usr/local/include --with-ld-opt=-L/usr/local/lib --conf-path=/usr/local/etc/nginx/nginx.conf --pid-path=/usr/local/var/run/nginx.pid --lock-path=/usr/local/var/run/nginx.lock --http-client-body-temp-path=/usr/local/var/run/nginx/client_body_temp --http-proxy-temp-path=/usr/local/var/run/nginx/proxy_temp --http-fastcgi-temp-path=/usr/local/var/run/nginx/fastcgi_temp --http-uwsgi-temp-path=/usr/local/var/run/nginx/uwsgi_temp --http-scgi-temp-path=/usr/local/var/run/nginx/scgi_temp --with-pcre-jit"