3 messages in ru.sysoev.nginxRe: bug or intent?: $request_uri in SSI
FromSent OnAttachments
LarrytheliquidNov 10, 2007 1:04 pm 
LarrytheliquidDec 10, 2007 12:02 am 
Evan MillerDec 29, 2007 3:01 pm 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: bug or intent?: $request_uri in SSIActions...
From:Evan Miller (emmi@public.gmane.org)
Date:Dec 29, 2007 3:01:31 pm
List:ru.sysoev.nginx

Larrytheliquid wrote:

After re-reading the documentation page (http://wiki.codemongers.com/NginxHttpCoreModule#var_request_uri), it turns out that "$request_uri" is indeed supposed to be the original request: "$request_uri, this variable is equal to the complete initial URI together with the arguments;"

Is there a variable like "$request_uri" that applies to the current request? If not, the alternative is an "if statement" that checks to see whether "$query_string" has a value. If it does, use $uri?$query_string, otherwise use $uri.

$is_args evaluates to "?" or "" depending on whether $args is set. Try:

$uri$is_args$args

Evan

On Nov 10, 2007 4:04 PM, Larrytheliquid <larr@public.gmane.org <mailto:larr@public.gmane.org>> wrote:

When including a file with SSI that has a query string, the $uri and $query_string variables are set to the included file. However, the $request_uri variable remains set to the original file. Is this supposed to happen, or should $request_uri change?

An example follows, just be sure to change "root /Users/larry/Sites/ngingx_request_uri/html;" to point to your local copy. Once you have created these files, go to http://127.0.0.1:8084/example.html?page=1

------------------------------------------------------ nginx.conf ------------------------------------------------------ worker_processes 1; events { worker_connections 256; }

http { server { listen 8084;

location / { ssi on;

default_type text/html;

root /Users/larry/Sites/ngingx_request_uri; } } }

------------------------------------------------------ example.html ------------------------------------------------------ <html> <head> <meta http-equiv="Content-type" content="text/html; <title>$request_uri with SSI</title> </head> <body> <h3>From example.html</h3> <p> <strong>$request_uri: </strong><!--# echo var="request_uri" --> :: <strong>$uri: </strong><!--# echo var="uri" --> :: <strong>$query_string: </strong><!--# echo var="query_string" --> </p> <!--# include virtual="/fragment.inc?page=1" --> </body> </html>

------------------------------------------------------ fragment.inc ------------------------------------------------------ <h3>From fragment.inc</h3> <p> <strong>$request_uri: </strong><em><!--# echo var="request_uri" --></em> :: <strong>$uri: </strong><!--# echo var="uri" --> :: <strong>$query_string: </strong><!--# echo var="query_string" --> </p> <p>Shouldn't $request_uri be "<em>/fragment.inc?page=1</em>"?</p>

-- Respectfully, Larry Diehl www.larrytheliquid.com <http://www.larrytheliquid.com>