rewrite problem after upgrade to 0.6.29
Raul Rivero
rivero at soitu.es
Fri Apr 4 15:05:20 MSD 2008
Hi all,
Sorry if this issue had been reported before but this one is my first
week in the list.
We have upgraded from NGINX 0.6.25 to 0.6.29 and we have a big problem
with our rewrite rules.
For this trial, our configuration was very simple:
* Port 80: NGINX.
* Port 81: Apache with PHP.
* Queries: user <==> NGINX <==> Apache.
* A PHP script (news.html) which contains:
<?php
echo $_REQUEST['id'];
?>
A simple rewrite rule:
location ^~ /news/ {
proxy_pass http://127.0.0.1:81/;
[...]
rewrite ^/news/([^/]+)/?$ /news.html?id=$1 break;
}
So, with 0.6.25, when i send the query 'http://127.0.0.1/news/one%20two'
what the Apache receive is:
127.0.0.1 [...] "GET /news.html?id=one%20two HTTP/1.0" 200 7
So, we get 'one two' from the PHP. Great :).
When we send the same query to 0.6.29, Apache gets:
127.0.0.1 [...] "GET /news.html?id=one two HTTP/1.0" 200 3
Oopppss! So PHP output is 'one'. But the real problem is the
"/news.html?id=one two" query. With spaces! :(
I located the problem inside 'ngx_http_script.c' file, if I changed ...
@@ -512,7 +504,7 @@
e->ip += sizeof(ngx_http_script_copy_capture_code_t);
if (code->n < e->ncaptures) {
- if ((e->is_args || e->quote)
+ if ((e->args || e->quote)
&& (e->request->quoted_uri || e->request->plus_in_uri))
{
return e->captures[code->n + 1] - e->captures[code->n]
@@ -539,7 +531,7 @@
e->ip += sizeof(ngx_http_script_copy_capture_code_t);
if (code->n < e->ncaptures) {
- if ((e->is_args || e->quote)
+ if ((e->args || e->quote)
&& (e->request->quoted_uri || e->request->plus_in_uri))
{
e->pos = (u_char *) ngx_escape_uri(e->pos,
... everything goes fine again. But there are more changes to that file
so i don't know if colateral effects.
Any idea? A bug?
Regards,
--
Raul Rivero | Micromedios Digitales |
Director Tecnico | Cochabamba, 11, bajo. Madrid, 28016. Spain |
soitu.es | Email: rivero at soitu.es Tel: +34 911420000 |
More information about the nginx
mailing list