bug or intent?: $request_uri in SSI

Larrytheliquid larrytheliquid at gmail.com
Sun Nov 11 00:04:23 MSK 2007


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; charset=utf-8">
    <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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20071110/6af79ed8/attachment.html>


More information about the nginx mailing list