Welcome! Log In Create A New Profile

Advanced

nginx error_page in php and ? changing to &

Patkob
September 30, 2010 02:42PM
Hello,

I haven't found solution for this problem, but if it was discussed
before, please direct me to the correct thread.

I'm using nginx/0.7.65 on debian lenny, and PHP 5.2.6-1+lenny9 with
Suhosin-Patch 0.9.6.2. Here's fragment of my config (username changed
to 'x'):

server {
[...]

error_page 400 /error.php?/400;
error_page 401 /error.php?/401;
error_page 402 /error.php?/402;
[... and so on ...]
error_page 413 /error.php?/413;
[...]

location = /error.php
{
internal;
root /home/x/public_html;
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /home/x/public_html
$fastcgi_script_name;
}

[...]
}

Everything is working great, when user tries to open non-existing
image my custom error page from /error.php?/404 shows up:

["REQUEST_URI"] => string "/gfx/notexistingfile"
["SCRIPT_FILENAME"] => string "/home/x/public_html/error.php"
["QUERY_STRING"] => string "/404"

But... for a strange reason (and my question to you is "WHY"),
sometimes i get in error.log something like this:

2010/09/25 10:43:54 [error] 12227#0: *64647 open() "/home/x/
public_html/error.php&/413" failed (2: No such file or directory),
client: 77.255.51.154, server: x.pl, request: "GET /error.php&/413
HTTP/1.1" , host: "www.x.pl"

Why is nginx changing "?" into "&" in this case? I have even tried to
rewrite this back, but it wasn't really working.

if ($request_uri ~ ^/error\.php) {
rewrite ^/error\.php.(.*)$ /error.php?$1
break;
}

Any thoughts?
Thanks, Pat.


_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

nginx error_page in php and ? changing to &

Patkob September 30, 2010 02:42PM

Re: nginx error_page in php and ? changing to &

Maxim Dounin October 01, 2010 08:02AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 204
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready