Welcome Guest, Not a member yet? Register   Sign In
Problem with query strings using CodeIgniter with nginx
#4

[eluser]Unknown[/eluser]
I've the same problem (facebook generates links with query params like ref, so i can't avoid it). I'm using php-fpm wiht 5.3.3 and what i've been found out by sniffing in to the network traffic between nginx and fpm is looks like this:
Code:
QUERY_STRING/some/url/123&ref=nf..REQUEST_METHODGET..CONTENT_TYPE..CONTENT_LENGTH..SCRIPT_NAME/some/index.php.1REQUEST_URI/some/url/123?ref=nf
the request is domain.com/some/url/123?ref=nf.
the nginx conf looks like this (the code is in a subfolder, but that's irrelevant for the problem):
Code:
location /some {
  if (!-e $request_filename) {
    rewrite ^/some/(.*)$ /some/index.php?/$1 last;
  }
}

as you can see, nginx seem to "repair" (replaces ? with a & in $query_string) the bugus query string (after the rewrite it will look like this: domain.com/some/index.php?/url/123?ref=nf), and because of that, the AUTO uri_protocol fails to find the "param" in the $_GET array in search of routing sources in the system/libraries/URI.php:68 (ci version 1.7.2) because of the count($_GET) == 1 condition.

my solution is:
1) use AUTO uri_protocol
2) subclass the CI_URI class, copy the function "_fetch_uri_string" to the new one and remove the count($_GET) == 1 from the condition (original in line 68).
Also enables you to hack back proper GET params from $_SERVER['REQUEST_URI'] but that's is an other story (-:


Messages In This Thread
Problem with query strings using CodeIgniter with nginx - by El Forum - 09-29-2010, 07:54 AM
Problem with query strings using CodeIgniter with nginx - by El Forum - 09-29-2010, 02:16 PM
Problem with query strings using CodeIgniter with nginx - by El Forum - 10-22-2010, 06:05 AM
Problem with query strings using CodeIgniter with nginx - by El Forum - 10-29-2010, 07:34 AM



Theme © iAndrew 2016 - Forum software by © MyBB