21 Jun 2017

Understanding nginx $request_uri

As we came across this question often ourselves, I decided to write a quick article about the $request_uri handling of nginx. According to the ngx_http_core_module-documentation, the variable $request_uri is defined as:

full original request URI (with arguments)

While this seems clear at first, it is not well defined. We have done some trial and error and can best explain it by examples using real cases:

  1. For the URL:
    the nginx variable $request_uri is populated as follows:
  2. For the URL:
    the nginx variable $request_uri is populated as follows:
  3. For the URL:
    the nginx variable $request_uri would still be populated only as follows:
    as #sec3.2 is just a fragment/comment/anchor and not part of the URI.

Simply put, the $request_uri contains the full path (/understanding-nginx-request_uri/ in example 1 or /cp/cart.php in example 2 above) and any argument strings that may be present (“?a=add&domain=register” in example 2 above), but excludes the schema (https:// and the port (implicit 443) in both examples above) as defined by RFC for the URL:

http_URL = "http(s):" "//" host [ ":" port ] [ abs_path [ "?" query ]]

Uniform Resource Identifiers

By RFC URIs have been known by many names: WWW addresses, Universal Document Identifiers, Universal Resource Identifiers, and finally the combination of Uniform Resource Locators (URL). As far as HTTP is concerned, Uniform Resource Identifiers are simply formatted strings which identify–via name, location, or any other characteristic–a resource.

Further Sources:

16 Feb 2017

A happy customer

Wir haben soeben eine Packung “Geile Weine” von einem zufriedenen Kunden per Kurier erhalten:

Testimonial Georg S.


.. vielen Dank für den Support, mit dem ihr mich immer rettet. Das weiss ich sehr zu schätzen! Prost!

Auf weitere spannende Moment in der Hotline.

Das freut uns natürlich immer sehr!

© 2006 - 2020 Webhosting24. All rights reserved. ICANN Policies.

back to top